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.
In this example, we will be doing a batch data sync using the Cinchy Table [Product].[Names Test]. In this scenario we will be using the following simple API as our destination: https://cinchy.net/API/Product/LatestCinchyReleaseDate
When we run our batch job, it will check for updates in our source table. These updates will trigger our REST API to fetch our defined value, which we can use in a post-sync script. In this case, our script will insert this value into a second table, [Product].[Response Table].
The following steps will walk you through how to utilize this functionality.
Set up your data sync to a REST API as normal. You can review our Source (Image 1), Destination (Image 2), and Sync Behaviour (Image 3) below.
2. Under the Post Sync tab, we want to input the CQL that, in our case, will take the defined variable from our REST API and insert it into the [Product].[Response Test] table (Image 4).
3. Add in your Permissions and click Save.
4. Once we have finished configuring our sync, we can run the job. It will check for new data in our Name column on our [Product].[Names] table (Image 5). When found, it will trigger the REST API to GET our “value” variable. Our post sync script will then take that value and INSERT it into the [Product].[Response Test] table (Image 6).