Skip to content

GraphQL

Courier sends GraphQL queries with autocomplete, validation and hover docs from the server’s schema.

Use GRAPHQL as the method. The query is the body. An optional JSON block of variables follows after a blank line:

### One country
# @operationName Country
GRAPHQL {{countriesApi}}
query Country($code: ID!) {
country(code: $code) { name capital emoji }
}
{ "code": "{{countryCode}}" }

A POST request with an X-Request-Type: GraphQL header is read the same way.

Courier sends {query, variables, operationName} as JSON. Tick Send as GET to send them as URL parameters instead.

The Query tab loads the schema by introspection. You can also load it from an SDL or introspection file. Courier caches it in .courier/schemas/.

With a schema loaded you get:

  • autocomplete and hover docs while you type,
  • validation of the query and of the variables against the operation,
  • Prettify (⇧⌥F),
  • an operation picker when the document has more than one operation,
  • a schema explorer that inserts fields into the query. ⌘-click a field to open it.

Generate variables fills in the variables you haven’t written yet.

GraphQL errors show above the response, each with a link to its line in the query.

Everything else works as for HTTP requests: chaining, scripts, code generation, run diff and Postman import.

GraphQL subscriptions aren’t supported.