Skip to content

GraphQL

GraphQL requests have their own editor — Query, Variables, Operation name, Headers, Auth — and send through the ordinary toolbar.

Underneath, the engine executes them as an HTTP POST. That is not a limitation to work around; it is why GraphQL gets auth injection, {{variable}} resolution, the cookie jar, gateway rewriting, tests, and history without any of it being reimplemented.

  1. Create a request with protocol GraphQL.
  2. Set the endpoint URL.
  3. Write the query or mutation in the Query tab.
  4. Put variables in the Variables tab as a JSON object.
  5. Set Operation name when the document contains more than one operation.
query GetUser($id: ID!) {
user(id: $id) {
id
email
roles
}
}
{ "id": "{{userId}}" }

{{variables}} resolve inside the query text and inside the variables JSON, so "{{userId}}" above is filled from the active environment at send time.

The response renders in the normal response pane — same JSON folding, same click-to-copy, same Tests tab.

Remember that GraphQL reports errors in the body with HTTP 200. A test asserting status eq 200 will pass on a failed query. Assert on the payload instead:

tests:
- source: body
path: data.user.id
op: exists
- source: body
path: errors
op: ne
expected: ""

GraphQL requests are chainable — they produce exactly one response. Extract from the body with a dotted path as usual:

extract:
- var: userId
from: body
path: data.user.id
  • Subscriptions. GraphQL over WebSocket is not supported. For a raw socket, use the WebSocket protocol directly.
  • Introspection. The editor does not fetch the schema, so there is no schema-aware completion for GraphQL. Spec-aware completion in the Editor view comes from bound OpenAPI documents.
- name: Get user
protocol: graphql
method: POST
url: "{{baseUrl}}/graphql"
graphql:
query: |
query GetUser($id: ID!) { user(id: $id) { id email } }
variables: '{"id":"{{userId}}"}'
operationName: GetUser
auth:
provider: users-api

variables is a JSON-encoded string, not a nested mapping.