Skip to content

GraphQL

Execute GraphQL queries and mutations.

2 modules

ModuleDescription
GraphQL MutationExecute a GraphQL mutation against an endpoint
GraphQL QueryExecute a GraphQL query against an endpoint

Modules

GraphQL Mutation

graphql.mutation

Execute a GraphQL mutation against an endpoint

Parameters:

NameTypeRequiredDefaultDescription
urlstringYes-GraphQL endpoint URL
mutationstringYes-GraphQL mutation string
variablesobjectNo-GraphQL mutation variables as key-value pairs
headersobjectNo-Additional HTTP headers to send with the request
auth_tokenstringNo-Bearer token for authentication (added as Authorization header)

Output:

FieldTypeDescription
dataobjectGraphQL response data
errorsarrayGraphQL errors (null if no errors)
status_codenumberHTTP status code

Example: Create user mutation

yaml
url: https://api.example.com/graphql
mutation: mutation CreateUser($input: UserInput!) { createUser(input: $input) { id name } }
variables: {"input": {"name": "John", "email": "john@example.com"}}

GraphQL Query

graphql.query

Execute a GraphQL query against an endpoint

Parameters:

NameTypeRequiredDefaultDescription
urlstringYes-GraphQL endpoint URL
querystringYes-GraphQL query string
variablesobjectNo-GraphQL query variables as key-value pairs
headersobjectNo-Additional HTTP headers to send with the request
auth_tokenstringNo-Bearer token for authentication (added as Authorization header)

Output:

FieldTypeDescription
dataobjectGraphQL response data
errorsarrayGraphQL errors (null if no errors)
status_codenumberHTTP status code

Example: Simple query

yaml
url: https://api.example.com/graphql
query: { users { id name } }

Example: Query with variables and auth

yaml
url: https://api.example.com/graphql
query: query GetUser($id: ID!) { user(id: $id) { id name email } }
variables: {"id": "123"}
auth_token: my-token

Released under the Apache 2.0 License.