Running a simple query

Connecting to a GraphQL server

GraphQL Connection

Switch to the GraphQL platform on Hoppscotch and connect to the below GraphQL server.

https://echo.hoppscotch.io/graphql

Once a sucessfull connection has been made, you can view both documentation and the schema using Hoppscotch.

It is important to explore the schema to understand the different queries, mutations, types and subscriptions that are offered by the Endpoint.

Running the query

Furthermore, you can run the query to fetch data as shown below:

Running GraphQL Query

Naruto GraphQL endpoint

Let's explore the Naruto GraphQL endpoint.

  1. Open Hoppscotch and connect to the endpoint below:
https://narutoql.up.railway.app/graphql
  1. Explore the schema and documentation to understand more about the endpoint.
  2. Write a query to get the character details who's name contains hatake
 {
  characters(filter: {name: "hatake"}) {
    results {
     _id
      name
      village
    }
  }
 }
  1. Click on the run button to execute the query.
  2. The query will return the following response.
{
  "data": {
    "characters": {
      "results": [
        {
          "_id": "61bd1dbc918f12c17b9c64b5",
          "name": "Hatake Kakashi",
          "village": "leaf village"
        },
        {
          "_id": "61bd1dbc918f12c17b9c64b6",
          "name": "Hatake Sakumo",
          "village": "leaf village"
        }
      ]
    }
  }
}

GraphQL

Learn more about GraphQL.