For the complete documentation index, see llms.txt. This page is also available as Markdown.

GraphQL

The GraphQL connector interacts with GraphQL APIs. It provides a single static function to send queries or mutations to an endpoint and retrieve the results. All functions in this class are static and execute without an instance configuration.

request

Sends a query or a mutation to a GraphQL API endpoint.

Parameters

Input
Description
Type

url

The endpoint URL of the GraphQL API.

string

document

The GraphQL query or mutation, written in standard GraphQL syntax.

string

variables

Optional variables required by the document.

object

headers

Optional request headers as key-value pairs, commonly used for authentication.

object

Right-click the headers input and mark it as a secret to mask tokens or credentials.

Examples

Example 1: Simple query

This queries a list of movies.

# url
https://api.example.com/graphql
# document
query {
  movies {
    id
    title
    releaseYear
  }
}

Example 2: Query with variables

This fetches a single movie by its ID, passed as a variable.

Example 3: Mutation

This creates a new movie.

Example 4: Query with authentication

This sends an Authorization header with a Bearer token.

Output

Returns the data payload from the GraphQL API. Throws an error if the request fails or the API returns execution errors.

Last updated

Was this helpful?