HOW TO

Extract changes from the change tracking table

Last Published: October 6, 2022

Summary

After enabling the "Keep track of created and updated features." option for a hosted feature service, these changes can be extracted from the change tracking table through REST. This is especially useful for workflows involving web hooks.

Procedure

  1. Navigate to the REST endpoint for the service, at the service level (not at the layer level).
  2. In the upper left corner, click the JSON button, and open the link in a new tab.
  3. In the new tab, go to the URL and append "&returnUpdate=true". This will give the most updated serverGen value for later steps.

Example:

https://services.arcgis.com/.../FeatureServer?f=pjson&token=[token]&returnUpdate=true
  1. At the bottom, click Extract Changes.
  2. For Layers, type in all of the layer IDs in which to return changes. For example: 0,1,2
  3. For the Layer Server Gens parameter, look at the JSON page from Step 3. Scroll down to a section called "changeTrackingInfo" that shows "layerServerGens". There should be a minServerGen and serverGen value for each layer ID. These allow a client to specify the last layer generation numbers for the changes received from the server.
    • minServerGen—It is the min generation of the server data changes.
    • serverGen—It is the current server generation number of the changes. Every changed feature has a version or a generation number that is changed every time the feature is updated.
(Sometimes, the minServerGen and serverGen are identical.)
  1. In the Layer Server Gens parameter text box, copy and paste the following syntax for the layer(s) from which to extract changes.
[
  {
    "id": <layerId1>,
    "serverGen": <genNum1>
  },
  {
    "id": <layerId2>,
    "serverGen": <genNum2>
  }
]
  1. Replace <layerId(n)> and <genNum(n)> with the layer's ID and its respective serverGen value.
Below is an example:
[
  {
    "id": 0,
    "serverGen": 54409838
  },
  {
    "id": 1,
    "serverGen": 54409838
  }
]
  1. Check the rest of the parameters for changes to extract (inserts, updates, and deletes), then click the Extract Changes button. This generates a statusURL.
  2. Click the URL to go to the job status page. If the status has not yet completed, keep checking the Check box until it completes. If there are records in the tracking table, it would give a URL link to a .json file to download. If there are no records in the table, the following response type: esriDataChangesResponseTypeNoEdits is seen.
  3. Download the resulting json, and open in it Notepad++ to see the adds, updates, and deletes made to the layer(s) in JSON format.

Article ID:000025224

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic