Articles in this section

Set up a connection to a GraphQL endpoint

A GraphQL connection lets integrator.io exchange data with any GraphQL endpoint, as the source or destination of your flows. This article covers how to create the connection, select an authentication type, configure rate-limit handling for APIs that throttle requests, and test and save the connection.

Additional resources: GraphQL documentation

Set up a GraphQL endpoint connection

From the Resources menu, select Connections, then select + Create connection at the top right.

Enter your GraphQL endpoint details

At this point, you’re presented with a series of options for providing GraphQL endpoint authentication.

GQL.png

Name (required): Provide a clear and distinguishable name. Throughout integrator.io imports and exports, you will have the option to choose this new connection, and a unique identifier will prove helpful later when selecting among a list of connections that you’ve created.

Mode (required): Select one of the following options

  • Cloud to connect to a publicly accessible server application.
  • On-premise to connect to a server that is publicly inaccessible and has an integrator.io agent installed on it.

Base URI (required): Provide the domain for your GraphQL endpoint. The application operates on a single endpoint (traditionally /GraphQL), and all requests are directed to this endpoint.

Authentication type (required): Select an authentication type from the list. HTTP authentication types also apply to GraphQL connections. Review the HTTP authentication type articles below to determine how to configure your authentication.

Non-standard API rate limiter

Most APIs limit the number of requests that can be sent for a given time period. The following settings in this section of the connection help you to define the custom rate-limit settings for connecting to your API.

When you configure any of these settings, integrator.io checks every response from the API for the rate-limit conditions you define — including responses that return a success status code such as 200. Some APIs report throttling inside an otherwise successful response; for example, Shopify's GraphQL API returns a 200 status code with "code": "THROTTLED" in the errors array. These settings let integrator.io recognize those responses as rate-limit errors instead of processing them as successful.

When integrator.io detects a rate-limit error, it automatically waits and retries the request based on the connection's rate-limit settings. You don't need to configure error handling on the exports or imports that use the connection. These settings work the same way for HTTP and GraphQL connections.

Wait time between HTTP requests (optional): This field lets you set the speed at which integrator.io makes requests. In other words, how long should the platform wait before making subsequent HTTP requests to the API? Wait time between HTTP requests should be set if the API does not implement rate-limiting and integrator.io should manually regulate call frequency. Enter the value for this field setting in milliseconds (integers, without the unit). This field can be used only when the Concurrency level is set to 1.

Override HTTP status code for rate-limit errors (optional): The HTTP specification states that rate-limit response errors should return a 429 status code. Some APIs have custom rate-limit implementations that rely on other status codes or even throttle errors within the HTTP body. Enter a value if the service you are connecting to uses a status code other than 429.

Path to rate-limit error field in HTTP response body (optional): If the service you are connecting to embeds rate limit errors within the HTTP body, provide the path (JSON path or XPATH) within the response body where integrator.io should look to identify a throttled response. If there is a specific value (or set of values) that indicates rate-limit response at this path, use the Rate-limit error values setting for further instructions on how to identify this type of error.

Rate-limit error values (optional): If you provided a path in Path to rate-limit error field in HTTP response body, then enter the exact values that the API will return to indicate rate-limit errors. Separate multiple values with a comma.

Override retry-after HTTP response header name (optional): HTTP services commonly return status code 429 when too many requests are made in a short period of time. This code typically accompanies a retry-after HTTP header response that specifies the time to wait until a successful request can be made. If the API returns this response header with a different name, specify the custom name in this setting.

HTTP response headers for rate-limit errors (optional): If the service you're connecting to signals rate-limit errors through HTTP response headers, use this field to specify the header name and value that integrator.io should check to identify a throttled response. Enter the header name in name and the value that indicates throttling in value. To evaluate a Handlebars expression against the response headers instead of matching a fixed value, select the Handlebars icon next to the value field.

If you configure more than one of these settings, integrator.io treats the response as rate-limited when any one of them matches.

Test the connection

To test the connection, you must choose an HTTP method and send a request that the endpoint can process.

GQLT.png

HTTP method (required): Choose between POST or GET. When you switch from POST to GET, integrator.io will build the query string from the body request content.

Query (required): Enter the query to be processed by the GraphQL endpoint. The supported operation type is either query or mutation. The operation type is required unless you're using the query shorthand syntax, in which case you can't supply a name or variable definitions for your operation. The query may also include an operation name, which is required for a multi-operations query.

Operation name: Only required if your query has two or more operations. A request can only execute one operation at a time.

The operation name is a meaningful and explicit name for your operation. Its use is encouraged because it is helpful for debugging and server-side logging. When something goes wrong, such as errors in your network logs or in your GraphQL server logs, it's easier to identify a query in your codebase by name instead of deciphering the contents. Think of it as a function name in your favorite programming language.

Variable: Defines the JSON variables used in your query. For example, if the query is query HeroNameAndFriends($episode: Episode), define the variable as {"episode":"JEDI"}.

Advanced settings

Before continuing, you have the opportunity to provide additional configuration information, if needed, for the GraphQL connection.

Save the connection

Once you have configured the GraphQL connection, you have a few options for continuing:

  • Save – select to test the connection and commit it so that it’s available to all integrations for your account
  • Cancel – select to exit without saving any new changes