request step function with method: post and the query in the body. Pass the query and its variables as separate body args.
Error handling
GraphQL returns200 even for errors, so check the response’s errors field rather than the status code:
Best practices
- Define variables for every dynamic value, and pass them in a separate
variablesobject rather than inlining them in the query string. - Request only the fields you need, and use fragments for reusable field selections.
- For pagination, use the provider’s cursor fields, such as
pageInfo.hasNextPageandpageInfo.endCursor.
Passing variables
Passing variables
Keep the query static and supply values through
variables:Related
Step functions: request
The request step used to issue the GraphQL POST.
Expression language
JEXL defaults and conditions used in the query variables and error check.