GraphQL
Description
Section titled “Description”This module allows executing GraphQL queries against any compatible endpoint. It performs a POST request with the provided query and variables, using Basic Auth authentication built from the configured credentials. It includes support for custom headers such as x-xtrem-endpoint and session cookies.
The module sends the query, validates the HTTP response and checks if there are GraphQL errors in the result. If the response is successful, it returns the data directly. If there are GraphQL errors, it reports them with full detail.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Credentials with username and password for Basic Auth |
| endpoint | text | Yes | GraphQL endpoint URL |
| query | text | Yes | GraphQL query to execute |
| variables | json | No | GraphQL query variables |
| xtremEndpoint | text | No | Value for x-xtrem-endpoint header (default: DEV) |
| clientCookie | text | No | Client session cookie |
Credentials
Section titled “Credentials”Credentials are obtained from the credentials system and must contain:
- username: Username for Basic Auth
- password: Password for Basic Auth
- clientCookie: Client session cookie (optional)
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": { "users": [ { "id": "1", "name": "Juan", "email": "juan@ejemplo.com" } ] }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "credentials_id": 1, "endpoint": "https://api.ejemplo.com/graphql", "query": "query { users { id name email } }", "variables": {}, "xtremEndpoint": "PROD"}API Used
Section titled “API Used”- User-configured GraphQL endpoint
- Protocol: HTTP POST with Content-Type application/json
- Uses node-fetch for HTTP requests
- Authentication is Basic Auth (Base64 of username:password)
- GraphQL errors are reported with the message and full details
- Does not support automatic pagination (use the graphqlQuery module for that)
- The x-xtrem-endpoint header is specific to certain services and can be omitted
- If no variables are provided, an empty object is sent
Related Nodes
Section titled “Related Nodes”- graphqlQuery (version with automatic pagination)