Extract Changes (Feature Service)
- URL:https://<catalog-url>/<serviceName>/FeatureServer/extractChanges(POST only)
Description
Feature service change tracking is an efficient change tracking mechanism for applications. Applications can use change tracking to query changes that have been made to the layers and tables in the service. For enterprise geodatabase-based feature services published from ArcGIS Pro 2.2 or later, the ChangeTracking capability requires all layers and tables to be either archive enabled or branch versioned and have globalid columns. Change tracking can also be enabled for ArcGIS Online-hosted feature services. If all layers and tables in the service have the ChangeTracking capability, the extractChanges operation can be used to get changes.
Check the subproperties of extractChangesCapabilities on the service resource to see which extractChanges options are supported. These include the following:
- supportsReturnIdsOnly—Allows the use of the returnIdsOnly parameter, which returns only the IDs of the features that were changed.
- supportsReturnExtentOnly—Allows the use of the returnExtentOnly parameter to return the extent of the changed features.
- supportsReturnAttachments—Allows the use of the returnAttachments parameter. This will return any attachments associated with the changed features.
- supportsLayerQueries—Allows the use of layerQueries to limit the changed features returned using filters such as a where clause.
- supportsGeometry—Allows the use of the geometry parameter, which will return changed features within a defined geometry.
- supportsReturnFeature—Allows full rows to be returned for updates or inserts as opposed to IDs only.

All properties listed within the extractChangesCapabilities can be true or false.
For 10.6.1 enterprise geodatabase-based feature services published from ArcGIS Pro 2.2, supportsReturnIdsOnly is the only subproperty set to true. This allows you to use the extractChanges operation to retrieve the objectids of the inserts, updates, and deletes that have happened since a specific time period.
Enable and disable change tracking
The feature service change tracking capability must be enabled to track layer changes. When change tracking is enabled, change tracking information is maintained for all rows in the layers and tables that are affected by any editing or sync operation.
To enable or disable change tracking on an existing feature service, add or remove the ChangeTracking capability to or from the feature service.
A feature service with change tracking enabled returns the following additional metadata. layerSrverGens in changeTrackingInfo must be cached on the client. The client needs to pass change layerServerGens to the server when requesting the latest changes from the server.
- {"capabilities" : "Create,Delete,Query,Update,Editing,ChangeTracking"}
- "changeTrackingInfo" : { "lastSyncDate" : 1519247516232, "layerServerGens" : [ { "id" : 0, "minServerGen" : 1529667, "serverGen" : 1534028 } ] },

At 10.6.1, enterprise geodatabase-based feature services do not support enabling and disabling the ChangeTracking capability. ChangeTracking will automatically be enabled on the geodatabase-based feature service if the data is archive enabled or is branch versioned and has globalid columns.
Hosted feature service views
The ChangeTracking service capability can be enabled or disabled on a feature service view if its source feature service has ChangeTracking enabled. ChangeTracking capability cannot be disabled on a source feature service if any of its views have ChangeTracking enabled.
hasChangeTrackingEnabledViews service property
Source feature services with views or map/tile service with change tracking enabled will return "hasChangeTrackingEnabledViews" : true in the metadata. This would allow the UX to block a user from disabling change tracking on a source feature service when its views also have change tracking enabled. This is a computed property and will be changed when the source feature service views change tracking is enabled or disabled or when views or map services are deleted.
New at 10.9
A new parameter, returnHasGeometryUpdates, has been added. When set to true, the response includes a hasGeometryUpdates=true property for each layer with updates that have geometry changes.
Request parameters
Parameter | Details |
---|---|
layers (Required) | The list of layers and tables to include in the replica. Syntax
Example
|
layerQueries | In addition to the layers and geometry parameters, the layerQueries parameter can be used to further define what changes to return. This parameter allows you to set query properties on a per-layer or per-table basis. If a layer's ID is present in the layers parameter and missing from layerQueries, its changed features that intersect with the filter geometry are returned. When the value is none, no features are returned based on where and filter geometry. If includeRelated is false, no features are returned. If includeRelated is true, features in this layer (that are related to the features in other layers in the replica) are returned. When the value is useFilter, features that satisfy filtering based on geometry and where are returned. The value of includeRelated is ignored. The properties include the following:
Values: none | useFilter | all Syntax
Examples
|
geometry | The geometry to apply as the spatial filter for the changes. All the changed features in layers intersecting this geometry will be returned. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS Online. In addition to the JSON structures, for envelopes and points, you can specify the geometry with a simpler comma-separated syntax. Syntax
Example
|
geomtryType | The type of geometry specified by the geometry parameter. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope. Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope |
inSR | The spatial reference of the input geometry. The spatial reference can be specified as either a well-known ID or a spatial reference JSON object, which can be defined using either a well-known ID (wkid) or a well-known text (wkt). If the inSR is not specified, the geometry is assumed to be in the special reference of the map. |
outSR | The output spatial reference of the returned changes. The spatial reference can be specified as either a well-known ID or a spatial reference JSON object, which can be defined using either a well-known ID (wkid) or well-known text (wkt). If the outSR is not specified, the data changes will be returned in the spatial reference of the feature service. |
gdbVersion | The geodatabase version name. This parameter applies only if the hasVersionedData property of the service and the isDataVersioned property of the layer or layers are true. If gdbVersion is not specified, the query will apply to the published map's version. ![]() This option can only be used with branch-versioned data. Example
|
returnInserts | If true, newly inserted features will be returned. The default is false. Values: true | false |
returnUpdates | If true, updated features will be returned. The default is false. Values: true | false |
returnDeletes | If true, deleted features will be returned. The default is false. Values: true | false |
layerServerGens (Required) | The layerServerGen allows a client to specify the last layer generation numbers for the changes received from the server.
Syntax
Example
|
returnIdsOnly | If true, the response includes an array of object IDs only. The default is false. Value: true | false |
returnExtentOnly | If true, only the extent of the changes will be returned. The default is false. Value: true | false |
returnHasGeometryUpdates | If true, the response includes a hasGeometryUpdates property set as true for each layer with updates that have geometry changes. The default is false. If a layer's edits include only inserts, deletes, or updates to fields other than geometry, hasGeometryUpdates is not set or is returned as false. When a layer has multiple rows with updates, only one needs to include a geometry changes for hasGeometryUpdates to be set as true. For an example of this, see the JSON Response examples section below. Setting returnHasGeometryUpdates to true also requires setting returnUpdates to true. Otherwise, an error is returned. ![]() returnHasGeometryUpdates is supported when the service's extractChangesCapabilities includes the supportsReturnHasGeometryUpdates property as true. Values: true | false |
returnAttachments | If true, attachment changes are returned in the response. Otherwise, attachments are not included. The default is false. This parameter is only applicable if the feature service has attachments. Values: true | false |
returnAttachmentsDatabyURL | If true, a reference to a URL will be provided for each attachment returned. Otherwise, attachments are embedded in the response. The default is true. This parameter is only applicable if the feature service has attachments and if returnAttachments is true and f=json. Value: true | false |
dataFormat | The format of the changes returned in the response. The default is json. Values: sqllite | json |
changesExtentGridCell | To optimize localizing changes extent, the value medium is an 8x8 grid that bounds the changes extent. It is used only when returnExtentOnly is true. The default is none. Values: none | large | medium | small |
f | The response format. The default value is html. Values: html | json |
Example usage
Below is a sample workflow that can be used with the extractChanges operation:
- Enable the feature service change tracking if it is not enabled by navigating to the updateDefiniton operation:and passing through the following updates (adding ChangeTracking to the list of capabilities):
https://services.myserver.com/<tenant>/ArcGIS/rest/admin/services/USA/FeatureServer/updateDefinition
"capabilities" : "Create,Delete,Query,Update,Editing,ChangeTracking,Sync"
- Once complete, retrieve the updates service's metadata using the returnUpdates parameter:
https://services.myserver.com/<tenant>/ArcGIS/rest/services/USA/FeatureServer?f=pjson&returnUpdates=true
- Cache the following json object input for layerServerGens in the client side:
{"layerServerGens":[{"id":0,"minServerGen":1529667,"serverGen":1534028}]}
- Once cached, call this operation and pass the layerServerGens parameter and any additional filtering criteria
- Update the client cached layerServerGens json object from the extractChanges response.
- Continue in steps 2-5.
Example inputs
The following example inputs can be used to return the inserts, updates, and deletions that have been made:
layers=0
returnInserts=true
returnUpdates=true
returnDeletes=true
layerServerGens=[{"id":0,"minServerGen":1529667,"serverGen":1534028}]}
dataFormat=json
f=json
JSON Response examples
{
"layerServerGens": [
{
"id": 0,
"serverGen": 153025
}
],
"transportType": "esriTransportTypeUrl",
"responseType": "esriDataChangesResponseTypeEdits",
"edits": [
{
"id": 0,
"features": {
"adds": [
{
"geometry": {
"rings": [
[
[
1599093.38156825,
4299494.38162189
],
[
1621892.61012839,
4282639.631925
],
[
1616369.15773174,
4273287.47109171
],
[
1596005.6876463,
4284510.52152801
],
[
1599093.38156825,
4299494.38162189
]
]
]
},
"attributes": {
"FID": 250,
"GlobalID": "C8FCEBF0-51D1-4FFA-A5ED-FFD47F10014F",
"ObjectID": 125,
"FIPS_CNTRY": "MT",
"GMI_CNTRY": "MLT",
"ISO_2DIGIT": "MT",
"ISO_3DIGIT": "MLT",
"ISO_NUM": 470,
"CNTRY_NAME": "Malta",
"LONG_NAME": "Republic of Malta",
"ISOSHRTNAM": "Malta",
"UNSHRTNAM": "Malta",
"LOCSHRTNAM": "Malta",
"LOCLNGNAM": "Repubblika ta' Malta",
"STATUS": "UN Member State",
"POP2007": 401880,
"SQKM": 211.5,
"SQMI": 81.66,
"LAND_SQKM": 316,
"COLORMAP": 2
}
}
],
"updates": [
{
"geometry": {
"rings": [
[
[
1599093.38156825,
4299494.38162189
],
[
1621892.61012839,
4282639.631925
],
[
1616369.15773174,
4273287.47109171
],
[
1596005.6876463,
4284510.52152801
],
[
1599093.38156825,
4299494.38162189
]
]
]
},
"attributes": {
"FID": 1,
"GlobalID": "CECC5D06-CFD4-40E7-943B-3793770411E1",
"ObjectID": 125,
"FIPS_CNTRY": "MT",
"GMI_CNTRY": "MLT",
"ISO_2DIGIT": "MT",
"ISO_3DIGIT": "MLT",
"ISO_NUM": 470,
"CNTRY_NAME": "Malta",
"LONG_NAME": "Republic of Malta",
"ISOSHRTNAM": "Malta",
"UNSHRTNAM": "Malta",
"LOCSHRTNAM": "Malta",
"LOCLNGNAM": "Repubblika ta' Malta",
"STATUS":" UN Member State",
"POP2007": 401880,
"SQKM": 211.5,
"SQMI": 81.66,
"LAND_SQKM": 316,
"COLORMAP": 2
}
}
],
"deleteIds": [
"0D8E1D93-29AE-4D16-AF61-E74FED983732"
]
}
}
]
}
The following example response has been generated from a request with returnIdsOnly as true, returnInserts as true, returnUpdates as true, and returnDeletes as true.
{
"layerServerGens": [
{
"id": 0,
"serverGen": 1526588581400
},
{
"id": 1,
"serverGen": 1526588581553
}
],
"edits": [
{
"id": 0,
"objectIds": {
"adds": [
2027,
2028,
2029
],
"updates": [2026],
"deletes": []
}
},
{
"id": 1,
"objectIds": {
"adds": [
27971,
27972
],
"updates": [],
"deletes": [
27189,
27970
]
}
}
]
}
The following example response has been generated from a request with returnHasGeometryUpdates as true as well as returnIdsOnly as true, returnInserts as true, returnUpdatesas true, and returnDeletes as true.
{
"layerServerGens": [
{
"id": 0,
"serverGen": 1526588581400
},
{
"id": 1,
"serverGen": 1526588581553
},
{
"id": 2,
"serverGen": 1526588581553
},
{
"id": 3,
"serverGen": 1526588581553
}
],
"edits": [
{
"id": 0,
"objectIds": {
"adds": [],
"updates": [2026, 2030],
"deletes": []
},
"hasGeometryUpdates": true //At least one geometry update was made
},
{
"id": 1,
"objectIds": {
"adds": [],
"updates": [27189, 27190],
"deletes": []
},
"hasGeometryUpdates": false //No geometry updates made
},
{
"id": 3,
"objectIds": {
"adds": [12],
"updates": [],
"deletes": [17] // No geometry updates were made, no hasGeometryUpdates property returned
}
}
]
}