HTTP Send GraphQL request function

Execute a GraphQL query with optional variables.

Help CentreBuilding Processes

This article describes the RPA HTTP functionality to execute a GraphQL query.

For a full list of available functions, please read HTTP functions.


Description

The Send GraphQL request function executes a GraphQL query or mutation with optional variables against a GraphQL API endpoint. The response includes both the data and any GraphQL-level errors.


Setting it up

To use the Send GraphQL request function, follow these instructions:

{{popups:rpas/add:action=api-graphql}}

Once on a process map:

  1. Navigate to the process where you would like to add the Send GraphQL request function
  2. Click on the green button's drop-down (right side of the green button labelled "Process")
  3. On the menu that appears, click on the "+ Activity" item
  4. From here you can select the Send GraphQL request option
  5. Click "Add" once you are done

Input parameters

ParameterRequiredTypeDefaultDescription
NameNoText-The alias of a previously created session (from api-session)
URLYesText-The GraphQL endpoint URL
QueryYesText-The GraphQL query or mutation string
VariablesNoJSON-Variables to pass to the GraphQL query as a JSON object
HeadersNoJSON-Additional headers for this request
TimeoutNoNumber-Request timeout in seconds
VariableNoTextresponseVariable name to store the response

Output variables

VariableTypeDescription
{response}ObjectThe response object containing data and/or errors keys

Errors

ErrorDescription
Connection failedUnable to establish a connection to the GraphQL endpoint
Query validation errorThe GraphQL query is invalid or does not match the schema

Tips

  • Always check response.body.errors for GraphQL-level errors, even when the HTTP status is 200
  • Use the variables parameter instead of string interpolation for dynamic values – this is safer and enables query caching
  • Use a session (api-session) with auth for APIs that require authentication

Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.