Help Centre › Building 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:
- Navigate to the process where you would like to add the Send GraphQL request function
- Click on the green button's drop-down (right side of the green button labelled "Process")
- On the menu that appears, click on the "+ Activity" item
- From here you can select the Send GraphQL request option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Name | No | Text | - | The alias of a previously created session (from api-session) |
| URL | Yes | Text | - | The GraphQL endpoint URL |
| Query | Yes | Text | - | The GraphQL query or mutation string |
| Variables | No | JSON | - | Variables to pass to the GraphQL query as a JSON object |
| Headers | No | JSON | - | Additional headers for this request |
| Timeout | No | Number | - | Request timeout in seconds |
| Variable | No | Text | response | Variable name to store the response |
Output variables
| Variable | Type | Description |
|---|---|---|
| {response} | Object | The response object containing data and/or errors keys |
Errors
| Error | Description |
|---|---|
| Connection failed | Unable to establish a connection to the GraphQL endpoint |
| Query validation error | The 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