GraphQL
Last updated
Last updated
GraphQL is a query language for APIs that provides a more efficient and flexible alternative to REST. It allows clients to request only the data they need and nothing more, streamlining interactions between the client and server. This results in potentially reduced traffic and server load.
Using the request
function, you can do a transaction on an existing GraphQL API.
There are multiple parameters at play for this request:
url
String
The GraphQL API endpoint.
document
String
Your GraphQL request. Either a query or a mutation in GraphQL notation.
variables
Object
Optionally provide variables with this parameter.
headers
Object
Any header key-value pairs (e.g. for authorization).
Insert the URL to the GraphQL API endpoint into the first field.
Insert the GraphQL query in the second field, including the query { ... }
part.
Optionally add variables or headers in the third and fourth input fields.
The variables field can be used to e.g. dynamically insert variables into the query.
The headers field can be used e.g. to add authorization info or declare which return type (e.g. json) the query should have, if supported by the endpoint.
To make requests with special characters, you need to declare the whole document input as text as described in Data processing -> Functions -> Inputs