GraphQL

HTTPBot has first-class support for GraphQL. Instead of hand-writing a JSON body, you get a dedicated editor with a separate query and variables editor, schema-aware autocomplete, a built-in schema browser so you can explore an API's types without leaving the request, and saved queries you can reuse across requests.

GraphQL is one of the request body types — everything below lives in the request's Body section.

Try it. The examples below run against the public PokéAPI GraphQL endpoint, https://beta.pokeapi.co/graphql/v1beta. Point a request there to follow along — it's a free, read-only API, so HTTPBot can fetch its schema for autocomplete and run the queries as-is.

Enabling GraphQL

Turn a request into a GraphQL request in either of two ways:

Because GraphQL is sent as a POST, switching a GET, HEAD, or DELETE request to GraphQL flips its method to POST automatically. Once enabled, the Body section shows two rows — Query and Variables — that open the editor.

The query editor

Tap Query (or Variables) to open the full-screen GraphQL editor. It's a syntax-highlighted code editor with a tab switcher at the bottom for moving between the Query and Variables panes.

The GraphQL editor showing the Query pane with a syntax-highlighted query.The GraphQL editor showing the Query pane with a syntax-highlighted query.The GraphQL editor showing the Query pane with a syntax-highlighted query.

You can optionally provide an operation name when a document defines more than one operation.

A query with variables:

query GetPokemon($limit: Int!) {
  pokemon_v2_pokemon(limit: $limit) {
    id
    name
    height
    weight
  }
}

The matching Variables JSON:

{
  "limit": 5
}

How it's sent

When you send the request, HTTPBot serializes the query, variables, and operation name into a single JSON body and posts it as application/json:

{
  "query": "query GetPokemon($limit: Int!) { ... }",
  "variables": { "limit": 5 },
  "operationName": "GetPokemon"
}

Schema-aware autocomplete

When the editor opens, HTTPBot fetches the API's schema by running an introspection query against the request's URL — no extra configuration. The editor uses that schema to power autocomplete and validation as you type, so it can suggest fields and arguments and flag references that don't exist in the schema. If the schema can't be fetched (for example the endpoint blocks introspection), the editor still works as a plain code editor.

Browsing the schema

To explore the API without leaving the request, open the editor's menu and choose View Schema. HTTPBot fetches the schema from the request URL and opens the GraphQL Schema browser.

From there you can drill into the API:

Every type reference is tappable, so you can navigate from a field to its return type and back, the same way you'd browse a GraphiQL docs panel.

The GraphQL Schema browser drilled into the query root, listing its fields and their types.The GraphQL Schema browser drilled into the query root, listing its fields and their types.The GraphQL Schema browser drilled into the query root, listing its fields and their types.

Saving and reusing queries

Queries and variables you use often can be saved and reused — handy when you keep coming back to the same handful of operations against an API:

The saved GraphQL queries list in Settings, showing several named queries.The saved GraphQL queries list in Settings, showing several named queries.The saved GraphQL queries list in Settings, showing several named queries.

Mutations

Mutations work exactly like queries — write the mutation in the Query editor and supply its inputs in Variables. The public PokéAPI endpoint is read-only, so the shape below is just for illustration; point the request at a write-capable API to actually run one:

mutation CreateUser($input: CreateUserInput!) {
  createUser(input: $input) {
    id
    name
  }
}

Variable substitution

The GraphQL query and variables both support {{variable}} placeholders, which HTTPBot resolves against your active environment and global variables before sending. That lets you keep things like an API host or an auth token in an environment and reuse the same request across setups. See Environments & Variables for how variables are defined and resolved.

Related pages