Guide - Syncing Changed Resources
Objective
It may be necessary to synchronize resources/objects that have been created/updated on Incentify into your internal system.
To accomplish this you will need to poll the Delta - List (GET) endpoint on a reasonable interval of your choice to retrieve change events (such as "updates", "creates", and "deletes") that have occurred on the Incentify system. This endpoint requires that you supply a timestamp of your last successful polling interval as it will only return Deltas that have occurred since that time.
As you ingest these changed resources into your internal system you also have the opportunity to update each resource (via the Delta - Mark Consumed (POST) endpoint) on Incentify with (1) an "consmed at" timestamp and (2) internal ID (if this is a resource that originated on Incentify) for future mapping.
Steps to Follow
1. Poll for list of changed resources
On an interval of your choosing (based on your requirements for minimum time before changes which originate from Incentify appear in your internal system), call Delta - List (GET) . You must always include a since_timestamp which is the timestamp of your last successfull poll, and optionally you can specify an internal_account_id to limit the results to a single account.
This will return a paginated list of any changed (created, updated, deleted)resources in reverse chronological order (ie; from your timestamp to now). The results should be iterated over one by one (in that order) and after each change has been consumed by your system you should follow the next step.
2. Process each changed resource
For each changed resource in the previous response, you should:
- Make a request to fetch that resource/object (ie; if the Delta is for a changed Activty record, then you will do a GET for that specific Activty to get the full information for that Activty to ingest)
- Ingest the changed resource to your internal system
- Issue a
POSTon the Delta - Mark Consumed (POST) endpoint, which will set theconsumed_attimestamp to "now". By setting this value Incentify will be able to monitor for change events where the updated at and consumed at times are not in alignment and inform you of potential synching gaps. If the delta is for a resource/object that originated on Incentify (ie; it is NOT yet in your database) then this endpoint request is also an opportunity for you to submit your newly generated internal ID back into Incentify for future mapping/updates.