Post sync scripts
Last updated
Last updated
Post sync scripts are written in CQL and can be added to the end of a sync to allow you to do more with your data, such as inserted retrieved values into a Cinchy table.
This example takes you through a batch data sync using the Cinchy Table [Product].[Names Test]. This scenario uses the following API as the destination: https://cinchy.net/API/Product/LatestCinchyReleaseDate
When you run the batch job, it will check for updates in the source table. These updates trigger the REST API to fetch our defined value, which we can use in a post-sync script. In this example, the script will insert this value into a second table, [Product].[Response Table].
The following steps will walk you through how to use this functionality.
Set up your data sync to a REST API. You can review the Source (Image 1), Destination (Image 2), and Sync Behaviour (Image 3) below.
Under the Post Sync tab, input the CQL that takes the defined variable from the REST API and insert it into the [Product].[Response Test] table (Image 4).
Add in your Permissions and click Save.
After you configure the sync, run the job. It will check for new data in the Name column on the [Product].[Names] table (Image 5). When found, it will trigger the REST API to GET the “value” variable. The post sync script will take that value and INSERT it into the [Product].[Response Test] table (Image 6).