GraphQL lets you ask an API for specific fields on a record. On the Linux desktop, Postman's Lightweight API Client can send a GraphQL request and show the fields the server returns.

Variables keep input values separate from the query. A lookup can request the same fields each time while the variable identifies a different record.

Postman can read the schema from an endpoint through introspection. The schema explorer shows which fields the API exposes and which input types those fields accept.

Steps to send a GraphQL request in Postman:

Start with the Lightweight API Client open and History visible. Have a GraphQL endpoint that accepts requests without credentials, a read-only query supported by its schema, and a valid value for its input.

  1. Click New in History.
  2. Select GraphQL in the request picker.
  3. Click the URL field beside the blue Query button.

    An empty field shows Enter URL.

  4. Enter your API's GraphQL endpoint URL in the field beside Query.

    https://api.example.test/graphql is the example URL for a local books API. Postman fills the schema explorer if your endpoint allows introspection.

  5. Click line 1 in the query editor to the right of the schema explorer.
  6. Enter your read-only GraphQL query in the editor.
    query Book($id: ID!) {
      book(id: $id) { id title }
    }

    The books example declares a required variable named $id of type ID! and requests the book's id and title. The query for your API uses the fields and input types from its schema.

  7. Click Variables at the bottom of the query editor.

    In a shorter window, Postman may collapse the query text into the Query Editor header when the variables editor opens.

  8. Click line 1 in the variables editor.
  9. Enter the JSON object with your variable value, replacing any existing contents.
    {"id": "2"}

    In the books example, the JSON key id supplies the value for $id. The value "2" selects book 2.

  10. Click the blue Query button beside the endpoint.

    The response status, time and size appear when Postman receives the reply.

  11. Verify in the response Body that data contains the fields you requested for the record you chose.

    For the books example, data.book contains id equal to "2" and title equal to "Practical APIs". An HTTP 200 OK can also accompany GraphQL errors, so the fields and values in the body tell you whether the lookup succeeded.

Share this guide