GraphQL Support

Learn how Postman supports working with GraphQL.

GraphQL with Postman floating in space around the stars. Illustration.

Many people think of Postman as an advanced REST client. But there's more: Beyond REST, Postman is a tool that handles any calls sent over HTTP, and that now includes GraphQL.

What is GraphQL?

GraphQL is a query language for APIs. GraphQL APIs are becoming more popular with developers because of some of the benefits they offer over RESTful APIs. One of the biggest benefits is that GraphQL allows for smarter and more precise querying which is especially useful when working with large APIs that return a lot of data. GraphQL enables users to specify exactly what data they get back in their response—nothing more, and nothing less, and it allows querying for multiple fields in a single request.

GraphQL vs. REST

GraphQL can provide some significant querying efficiencies as compared to REST. Let's look at a specific example: If you wanted to use the Spotify REST API to get a list of all of the titles of all of the tracks of all of the albums by a particular artist, you would need to make three queries. You would need one query to find the artist ID, another to find all of the albums, and another to find all of the tracks on each album. If you were using the Spotify GraphQL API, you could access all of that data with a single query.

GraphQL in Postman

Postman now supports sending GraphQL queries in the request body, GraphQL variables, and GraphQL query auto-completion. Additionally, GraphQL support paired with our recent release of schema support and building APIs directly in Postman means users can now create and store GraphQL schemas directly in Postman itself.

How your GraphQL response will appear in Postman. Screenshot.

Creating a GraphQL API Schema for Query Auto-completion

Query auto-completion is one of the most popular aspects of Postman's GraphQL support. The query auto-completion is powered by Postman API schemas. To create a GraphQL API schema in Postman:

  • Go to the APIs tab in Postman

  • Click + New API

  • Name your API

  • Make sure you're in the Define tab

  • Select GraphQL as your spec from the dropdown menu

  • Add your schema and save

  • Head back over to the Collections tab

  • Attach your schema by selecting it from the drop-down menu

  • Start typing and you should see query auto-completion working

  • Finally, you should see your GraphQL response

On the Postman Blog

Announcing Postman’s new GraphQL client

We’re excited to announce that Postman’s new GraphQL client is in open beta! Applying our learnings from building support for WebSockets, Socket.IO,…

Read more →

Convert a GraphQL schema into a Postman Collection with GraphMan

This is a guest post written by Nohé Hinniger-Foray, R&D engineer at Escape Technologies. GraphQL is one of the most popular query…

Read more →

Don’t panic: a developer’s guide to building secure GraphQL APIs

At this year’s API Specifications Conference (ASC), Postman Developer Advocate Meenakshi Dhanani shared the dos and don’ts of designing secure GraphQL APIs…

Read more →