The Request object is a versatile tool that can be used in multiple places of a connector to configure an API request to be done to the data source API. Request object is often used, for example, in:
Authentication: Used in OAuth2 authentication flow to perform authorization, token exchange, and token refresh requests
Data source user: Used to fetch additional information about the authenticated user
Accounts: Used to fetch a list of accounts that the authenticated user has access to
Reporting: Used to fetch data from the data source API
Structure of the request configuration
In the request object, you can configure multiple different properties, and here you can find explanations for the ones that are most commonly needed with different APIs:
Field | Description |
|---|---|
type | Type of the request. Defines if the request should be performed as a synchronous request or use an asynchronous request flow. Possible values
Default value: |
method | Defines the request method to use for the request. Available methods:
|
url | Defines to which URL the request is made. For example, the endpoint from which data is fetched, like Note: You can use placeholders within the URL to apply dynamic values to the request URL. For example, |
headers | Under headers, you can define an array of headers to be sent as part of the request. Headers are defined as key-value pairs, like below. You can configure multiple headers, and header values can be configured as static values, like the agent below, or you can use placeholders within headers. |
parameters | Similar to headers, under parameters, you can define an array of parameters to be sent as part of the request. Request parameters are added to the request url in the format Parameters are defined as key-value pairs, like below. You can configure multiple parameters, and parameter values can be configured as static values, like the country code below, or you can use placeholders within headers. |
body | The body defines data that is sent in the body of the request. Under the body object, you can define further settings for the response body:
|
response | The response object defines how the response received from the API is handled.
Please see the additional documentation on response handling below. |
Response handling
Response object within the request object defines how the response returned by the API is handled. There are several configuration options available for you to handle different kinds of responses.
Here you can find explanations for the ones that are most commonly needed with different APIs:
Field | Description |
|---|---|
type | Type of the response. Defines the format in which we expect the API response to be. Possible values
Default value: |
dataRows | Data rows define where to read data from. Usually, this points to an array of elements. For example, a response might look like: To be able to fetch data from the rows, |
pagination | Defines how to paginate through the pages when the response contains multiple pages of data. Please see pagination below for further documentation. |
Pagination
The pagination object under the response defines how we paginate through the pages when the response contains multiple pages of data.
The Connector builder supports multiple pagination strategies:
Type | Description |
|---|---|
Cursor | Cursor pagination fetches next page based on a cursor (also called a token) provided by the previous page.
Example configuration: |
In URL cursor | Same as Cursor but cursor is always sent as request URL parameter regardless of request type (GET or POST). Example configuration: |
Row count | Row count pagination fetches new pages until one of four stop clauses is reached:
Example configuration: |
Offset | Offset pagination counts all the result rows, and then adds the total number of fetched rows to a variable, which is sent to the data source with the next request. Example configuration: |
Template configuration
Below you can find a basic template that you can use as a base when building your request.
Synchronous GET request
"request": {
"type": "sync",
"method": "GET",
"url": "[URL of the API endpoint]",
"headers": [
{
"name": "[header 1 name]",
"value": "[header 1 value]"
}
],
"parameters": [
{
"name": "[parameter 1 name]",
"value": "[parameter 1 value]"
},
{
"name": "[parameter 2 name]",
"value": "[parameter 2 value]"
}
],
"response": {
"type": "JSON",
"dataRows": {
"source": "jsonPath",
"value": "$.*"
}
}
},