REST API
Last updated
Last updated
To connect a REST API as a Data Source, fill in the following parameters (Image 1):
Add in your applicable columns (Image 2). Review the documentation here for information on the column types available.
You can add in other sections by selecting the "Add a Section" drop down, and selecting from the list (Image 3). Note that a pagination block is mandatory.
You can add in an Auth Request (Image 4) by reviewing the documentation here.
You can add in Request Headers (Image 5) by reviewing the documentation here.
Cinchy v5.5 added an Authorization header type for REST API data syncs in Connections. An authorization request header can be used to provide credentials that authenticate a user with a server, allowing access to a protected resource. Selecting this header defines the Header Value as a password field.
You are able to use this section to add body content (Image 6):
A pagination block is mandatory (Image 7). Review the documentation here for more on pagination blocks.
Cinchy v5.5 introduced the Retry Configuration for REST API targets. This will automatically retry HTTP Requests on failure based on a defined set of conditions. This capability provides a mechanism to recover from transient errors such as network disruptions or temporary service outages.
Note: the maximum number of retries is capped at 10.
To set up a retry specification:
Under the REST API source tab, select API Specification > Retry Configuration
2. Select your Delay Strategy.
Linear Backoff: Defines a delay of approximately n seconds where n = current retry attempt.
Exponential Backoff: A strategy where every new retry attempt is delayed exponentially by 2^n seconds, where n = current retry attempt.
Example: you defined Max Attempts = 3. Your first retry is going to be in 2^1 = 2, second: 2^2 = 4, third: 2^3 = 8 sec.
3. Input your Max Attempts. The maximum number of retries allowed is 10.
4. Define your Retry Conditions. You must define the conditions under which a retry should be attempted. For the Retry to trigger, at least one of the "Retry Conditions" has to evaluate to true.
Retry conditions are only evaluated if the response code is not 2xx Success.
Each Retry Condition contains one or more "Attribute Match" sections. This defines a Regex to evaluate against a section of the HTTP response. The following are the three areas of the HTTP response that can be inspected:
Response Code
Header
Body
If there are multiple "Attribute Match" blocks within a Retry Condition, all have to match for the retry condition to evaluate to true.
Note that the Regex value should be entered as a regular expression. The Regex engine is .NET and expressions can be tested by using this online tool. In the below example, the Regex is designed to match any HTTP 5xx Server Error Codes, using a Regex value of "5[0-9][0-9]". For Headers, the format of the Header string which the Regex is applied against is {Header Name}={Header Value}, e.g. "Content-Type=application/json".
Parameter
Value
HTTP Method
GET or POST
API Response Format
Specify a response format of the endpoint
Records Root JSONPath
Specify the JSON path for the results. This path will depend on the format of your response. Example: "$.payload" If the JSON response top-element is an object, $ will refer to the top-element of the response.
If the JSON response top-element is an array, the CLI code will wrap the array in an object. The object will contain the array under member name.
Path to Iterate
Specify the path to Iterate.
API Endpoint URL
API endpoint, including URL parameters like API key
Next Page URL JSON Path
Specify the path for the next page URL. This is only relevant for APIs that use cursor pagination