Newer Version Available
Data Replication Steps
The following is a typical data replication procedure for an object:
- Optionally, determine whether the structure of the object has changed since the last replication request, as described in Checking for Structural Changes in the Object.
- Call getUpdated(), passing in the object and timespan for which to retrieve data.
Note that getUpdated() retrieves the IDs for data to which the logged in user has access. Data that is outside of the user’s sharing model is not returned. The API returns the ID of every changed object that is visible to you, regardless of what change occurred in the object. For information on IDs, see ID Field Type.
- Pass in all IDs in an array. For each ID element in the array, call retrieve() to obtain the latest information you want from the associated object. You must then take the appropriate action on the local data, such as inserting new rows or updating existing ones with the latest information.
- Call getDeleted(), passing in the object and timespan for which to retrieve data. Like getUpdated(), getDeleted() retrieves the IDs for data to which the logged-in user has access. Data that is outside of the user’s sharing model is not returned. The API returns the ID of every changed object that is visible to you, regardless of what change occurred in the object, based on SystemModstamp field information if available. For information on IDs, see ID Field Type.
- Iterate through the returned array of IDs. Your client application must then take the appropriate action on the local data to remove (or flag as deleted) the deleted objects. If your client application cannot match rows in the local data using the retrieved object ID, then the local data rows either were deleted or were never created, in which case there is nothing to do.
- Optionally, save the request time spans for future reference. You can do this with the getDeleted() latestDateCovered value or the getUpdated() latestDateCovered value.