Querying with GraphQL
Many people think of Postman as an advanced REST client. Beyond REST, Postman is a tool that handles any calls sent over HTTP. This means that you can use Postman to interact with protocol-agnostic APIs - such as SOAP and GraphQL, which can both utilize HTTP, just like REST.
Learn how Postman supports working with GraphQL.
- Sending GraphQL queries in request body as POST requests
- Support for GraphQL variables
- Creating APIs in Postman with GraphQL schema type
- Query autocompletion integrated with user defined GraphQL schemas
Try it out in Postman with this example template.
Sending a GraphQL query
There's a few ways for you to author and send a GraphQL query in Postman. The following screen illustrates one way to send a GraphQL query using Postman's inbuilt support.
Under the Body tab, select the GraphQL body type. Enter your GraphQL query in the Query editor. This editor enables you to author both queries and variables separately, as described in the following section.
Working with GraphQL variables
Postman provides a separate interface to author GraphQL variables. After defining your GraphQL query in the Query editor, you can author and edit GraphQL variables in the adjacent variables editor.
You can also use Postman variables as data inputs for GraphQL variables using {{variable}}
syntax.
Importing GraphQL schemas
To create or import a GraphQL schemas into Postman, complete the following steps.
- Under the APIs tab, click + New API, navigate to the Define tab, and then select Create new or Import file.
- Choose GraphQL from the dropdown, and click Save.
Autocomplete for GraphQL
Once you create or import a GraphQL schema as described above, you can enable autocompletion within the GraphQL query editor.