> ## Content Index
> Fetch the complete content index at: https://codetraveler.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Using Postman with GraphQL APIs
- URL: https://codetraveler.io/2019/01/12/how-to-use-postman-with-a-graphql-api/
- Published: 2019-01-12T18:53:00.000Z
- Updated: 2019-05-06T15:41:51.000Z
- Description: Using Postman to quickly and easily query GraphQL APIs
- Author: Brandon Minnick
- Tags: postman, graphql, REST, API, endpoint

Let's explore two ways to use [Postman](https://www.getpostman.com/?ref=codetraveler.io) to interact with GraphQL APIs

If you're like me, you've been using [Postman](https://www.getpostman.com/?ref=codetraveler.io) to inspect REST APIs for years. But with the advent of GraphQL, how can we continue using this awesome tool?

First, let's find a valid query for an existing GraphQL endpoint.

# Exploring GraphQL APIs using GraphiQL

Let's find a query for the [Star Wars API](https://swapi.apis.guru/?ref=codetraveler.io), aka SWAPI, using GraphiQL: [https://swapi.apis.guru/graphiql](https://swapi.apis.guru/graphiql?ref=codetraveler.io).

This query returns the `id`, `title` and `episodeID` for the six original Star Wars films.

```
query{
  allFilms
  {
   films {
      id
      title
      episodeID
    }
  }
}
```

Here's how it looks in GraphiQL.

![](https://storage.ghost.io/c/dc/c2/dcc2e43e-24f8-46bb-a899-9c446f3ef794/content/images/2019/01/image.png)

Great! Now how do we do this in Postman?

# Exploring GraphQL APIs using Postman

Each GraphQL Endpoint is a POST API, and its Body is just one `JSON` object: `query`.

We can take the same query that we used above in GraphiQL, to create the `JSON` request.

```json
{
    "query" : "query { allFilms { films { id title episodeID } } }"
}

```

![](https://storage.ghost.io/c/dc/c2/dcc2e43e-24f8-46bb-a899-9c446f3ef794/content/images/2019/01/image-1.png)

# Bonus: application/graphql

If the GraphQL endpoint accepts the header `application/graphql`, we don't need to use JSON in the Body.

First, add the header `Content-type: application/graphql`.

![](https://storage.ghost.io/c/dc/c2/dcc2e43e-24f8-46bb-a899-9c446f3ef794/content/images/2019/01/image-2.png)

Now we can use the same GraphQL query that we used above in GraphiQL for the request body.

![](https://storage.ghost.io/c/dc/c2/dcc2e43e-24f8-46bb-a899-9c446f3ef794/content/images/2019/01/image-3.png)