REST API (Cinchy Event Triggered)
Overview
Data changes in Cinchy (CDC) can be used to trigger a data sync from a REST API data source to a specified target. The attributes of the CDC Event are available to use as parameters within the REST API Data Source Definition to narrow the scope of the request. For example, a lookup.
\
Info tab
You can find the parameters in the Info tab below (Image 1).
Values
Parameter | Description | Example |
---|---|---|
Title | Mandatory. Input a name for your data sync | REST API (CDC) to Cinchy |
Description | Optional. Add in a description for your sync. There is a 500 character limit in thie field. | |
Variables | Optional. Review our documentation on Variables here for more information about this field. | |
Permissions | Data syncs are role based access systems where you can give specific groups read, write, execute, and/or all of the above with admin access. Inputting at least an Admin Group is mandatory. |
Source tab
Mandatory and optional parameters for the Source tab are outlined below (Image 2).
- Listener Config
- Source Details
- Schema
- Filter
\The following column parameters can be found in the Listener Config table:
Parameter | Description | Example |
---|---|---|
Name | Mandatory. Provide a name for your listener config. | REST API (CDC) real-time sync |
Event Connector Type | Mandatory. Select your Connector type from the drop-down menu. | REST API (CDC) |
Topic | Mandatory. This field is expecting a JSON formatted value specific to the connector type you are configuring. | See the Topic tab. |
Connection Attributes | Mandatory. This field is expecting a JSON formatted value specific to the connector type you are configuring. | See the Connection Attributes tab. |
Status | Mandatory. Set to "Enabled" to activate the listener. Leave on "Disabled" until you are ready to start syncing. | Enabled /Disabled |
Running Status | Read-only. Shows the current state of the listener as Starting, Running, or Failed. This is automatically managed by the system. For more information, see the Listener status section. | Running |
Active | Managed by User/System. Indicates whether the listener is set to retry after failure ("Yes") or has stopped attempting to sync and requires user intervention ("No"). | Yes /No |
Data Sync Config | Mandatory. This drop-down will list all the data syncs on your platform. Select the one that you want to use for your real-time sync. | CDC Data Sync |
Subscription Expires On | Salesforce Stream Sources only. This field is a timestamp that's auto populated when it has successfully subscribed to a topic. | |
Message | Auto-populated. This field reports errors that occur during the sync. | |
Auto Offset Reset | Earliest, Latest, None. Determines where to start reading events if there is no last message ID or if it's invalid. Can be adjusted post-configuration. Learn more | Earliest ,Latest , None |
Parameter | Description | Example |
---|---|---|
Source | Mandatory. Select your source from the drop down menu. | REST API |
HTTP Method | Mandatory. | This will be either GET or POST. |
API Response Format | Mandatory. Use this field to specify a response format of the endpoint. Currently, the Connections UI only supports JSON responses. | JSON |
Records Root JSONPath | Mandatory. Specify the JSON path for the results. The root of a JSON object is $ . If the top-element of the response is an array, Cinchy places the array under a "data" key in a new JSON object. See Best practices for more info. | $.data , $ , $.ResponseObject |
Path to Iterate | The path to select an array of records for capturing elements inside. A record is created for each element which you can use as the input in a source schema. The path is relative to the root JSONPath. | |
API Endpoint URL | Mandatory. API endpoint, including URL parameters like API key | https://www.quandl.com/api/v3/datatables/CLS/IDHP?fx\_business\_date=2024-01-01\&api\_key=@API\_KEY |
Next Page URL JSONPath | Specify the path for the next page URL. This is only relevant for APIs that use cursor pagination |
**The** Schema section is where you define which source columns you want to sync in your connection. You can repeat the values for multiple columns.
Parameter | Description | Example |
---|---|---|
Name | Mandatory. The name of your column as it appears in the source. | Name |
Alias | Optional. You may choose to use an alias on your column so that it has a different name in the data sync. | |
Data Type | Mandatory. The data type of the column values. | Text |
Description | Optional. You may choose to add a description to your column. |
Select Show Advanced for more options for the Schema section.
Parameter | Description | Example |
---|---|---|
Mandatory |
| |
Validate Data |
| |
Trim Whitespace | Optional if data type = text. For Text data types, you can choose whether to trim the whitespace._ | |
Max Length | Optional if data type = text. You can input a numerical value in this field that represents the maximum length of the data that can be synced in your column. If the value is exceeded, the row will be rejected (you can find this error in the Execution Log). |
You can choose to add in a Transformation > String Replacement by inputting the following:
Parameter | Description | Example |
---|---|---|
Pattern | Mandatory if using a Transformation. The pattern for your string replacement. | |
Replacement | What you want to replace your pattern with. |
You have the option to add a source filter to your data sync. Please review the documentation here for more information on source filters.
Example use case
An organization wants to use the Dun & Bradstreet API for enriching company information, such as the number of employees or their addresses. When a company record is added or modified in a table called Companies inside of Cinchy, a D&B API should be triggered with the Company Name (a mandatory field on the Companies table) passed in as a parameter, and the Company record should be enriched with the company information from the API response.
Define the connection
The following sections in the Source configuration of the Connections experience can reference attributes of the CDC Event as parameters:
- Auth Request -> Body
- Auth Request -> Request Headers -> Header -> Header Value
- Auth Request -> Endpoint URL
- Body
- Request Headers -> Header -> Header Value
- API Endpoint URL
Parameters use the column name or alias as defined in the CDC Event's Listener Config prefixed with an @
. For example, @CompanyName
would be the parameter name for the following Cinchy CDC listener Topic configuration.
{
"tableGuid": "420c1851-31ed-4ada-a71b-31659bca6f92",
"fields": [
{
"column": "Cinchy Id",
"alias": "CinchyId"
},
{
"column": "Company Name",
"alias": "CompanyName"
}
]
}
Parameter names are case sensitive when used in the Connection configuration. Parameter matching is performed using literal string replacements. Names shouldn't contain spaces (spaces are automatically removed), and should have differing prefixes.
The following set of parameters will be available on every event even if they're not present in the Listener Config table:
- @Version
- @DraftVersion
- @CinchyRecordType
- @ApprovalState
- @ModifiedBy
- @Modified
- @Deleted
Listener config
To configure a REST API (Cinchy Event Triggered) connection, a listener must be configured. If configuring using the Listener Config table, you would select the Event Connector Type of Cinchy CDC.
Otherwise, you can set up your listener configuration for your data sync through the Connections UI, keeping the following constraints in mind:
- Column names in the listener config shouldn't contain spaces. If they do, they will be automatically removed. For example, a column named **Company Name **will become the replacement parameter @CompanyName.
- The replacement parameter names are case sensitive.
- Column names in the listener config shouldn't be prefixes of other column names. For example, if you have a column called Name, you shouldn't have another called Name2 as the value of @Name2 may end up being replaced by the value of @Namesuffixed with a
2
.
Example Listener Configuration
{
"tableGuid": "420c1851-31ed-4ada-a71b-31659bca6f92",
"fields": [
{
"column": "Cinchy Id",
"alias": "CinchyId"
},
{
"column": "Company Name",
"alias": "CompanyName"
}
]
}