Skip to main content

GraphQL

A GraphQL Source in Flowlyze is a scheduled inbound job that, based on the flow schedule (e.g. cron), calls a GraphQL endpoint, sends a request (query or mutation), and enqueues the response payload for processing. It extends the behavior of HTTP sources and uses the flow’s GraphQL settings to build the request, send it, and interpret the response.

It allows executing GraphQL operations against endpoints accessible via HTTP: the client specifies the desired data, and the server responds with a JSON structure that mirrors the request. The typical transport is HTTP (usually POST) with a JSON body.

Configuration

PropertyDescription
UrlFull URL of the GraphQL endpoint (e.g. https://api.example.com/graphql). Cannot be empty.
MethodHTTP method: GET or POST.
QueryGraphQL query (or mutation) string. Cannot be empty.
VariablesJSON string containing the query variables.
OperationNameName of the operation when the document contains multiple operations.
HeadersHTTP headers added to the request (e.g. Authorization, X-Custom-Header).
HttpRequestAuthSettingsAuthentication configuration (e.g. bearer token, API key).
DataFieldJSON path for the data field in the GraphQL response (JSONPath). Used to extract the payload to be enqueued.
ErrorsFieldJSON path for the errors array in the response. If present and not empty, the job raises an exception with the error messages.

Response handling

A GraphQL endpoint response is typically in JSON format.

  • HTTP errors: if the HTTP status is not 2xx (e.g. 400, 401, 403, 429, 500), the request is considered failed and an exception is raised (including status, body, and error message).
  • GraphQL errors: the job reads the token specified by ErrorsField (default "errors"). If it is a non-empty array, it collects the message from each element and raises: "Error in GraphQL: {messages}".
  • Extensions: if the root object contains an extensions token, it is logged at an informational level (e.g. rate limits, query cost).
  • Data extraction: the token specified by DataField (default "data") is used to build the list of messages:
  • Array: each element (as a JObject) is enqueued as a separate message.
  • Object: a single JObject is enqueued as one message.

Authentication

Authentication is handled in the same way as for the HTTP Source: Bearer token, API key, Basic Auth, OAuth2, JWT, etc. (See the Http section for supported authentication methods.)