GraphQL
Select GraphQL as the query type to retrieve data from GraphQL endpoints. GraphQL queries work similarly to JSON queries but use the POST method with a query body.
With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Infinity plugin GraphQL demo.
Configure a GraphQL query
To query a GraphQL endpoint:
- Select GraphQL as the query type.
- Enter the GraphQL endpoint URL.
- Set the HTTP method to POST.
- Click the expand icon next to the URL to open advanced options.
- Enter your GraphQL query in the query field.
- Define columns to extract specific fields from the response.
Example query
The following example queries a countries API to retrieve country names and continent information:
URL: https://countries.trevorblades.com/graphql
GraphQL query:
{
countries {
name
continent {
name
}
}
}Root selector: data.countries
Columns configuration:
GraphQL variables
You can include variables in your GraphQL queries. Enter variables as JSON in the variables field:
{
"code": "US"
}Then reference them in your query:
query($code: ID!) {
country(code: $code) {
name
capital
}
}Parser options
GraphQL responses are JSON, so all JSON parser options are available:
- JSONata parser: For data transformations, alerting, and recorded queries
- JQ parser: For data transformations, alerting, and recorded queries
- UQL parser: For advanced in-memory transformations
Refer to JSON for details on parser options.



