Skip to content

GraphQL

Right-click in the tree ▸ Add ▸ GraphQL request.

A GraphQL tab with the query editor, the Variables section below it and the headers

FieldRole
URLThe GraphQL endpoint
Operation typequery, mutation or subscription
QueryThe GraphQL document, with syntax highlighting
VariablesThe operation’s variables, in JSON
Operation nameRequired as soon as the document holds several named operations
HeadersAs for an HTTP request

Restorm {{variables}} work inside the document just as they do in the GraphQL variables — take care not to confuse the two systems: $id is a GraphQL variable, {{id}} a Restorm one.

A subscription opens a stream: messages arrive as they come in the response panel. In a scenario, the GraphQL subscribe / GraphQL unsubscribe actions drive that same stream and emit one event per message received.

A .graphql / .gql (SDL) file creates a complete tree: one folder per operation type, one request per root field, with argument variables pre-filled, the API documentation and the enumerations. See Importing a GraphQL schema.

Postman, Bruno, Insomnia and Thunder Client collections whose requests are of GraphQL type are imported as GraphQL requests, not as HTTP requests.

Restorm can host a mock GraphQL server: you supply the schema (SDL) and, optionally, canned values per field (Query.pets) or a JavaScript resolver script that takes precedence over them. Subscriptions are served too. See Mocking a GraphQL API.

Thirteen targets: cURL, JavaScript (Fetch, Apollo Client), TypeScript, Python (Requests, gql), Go (graphql-go), Ruby (graphql-client), PHP (Guzzle), C# (GraphQL.Client), Java (graphql-java), Swift (Apollo iOS), Kotlin (Apollo Kotlin).