Cleanup Change Tracking

URL:
https://<adminservicecatalog-url>/services/<serviceName>/FeatureServer/cleanupChangeTracking
Methods:
POST
Version Introduced:
11.5

Description

The cleanupChangeTracking operation removes archived entries of changes made to a hosted feature service that fall outside of a specified window of time. Changes made within the specified window are not removed.

Hosted features can be configured to keep track of changes. Operations such as sync and automatic tile generation rely on the archived information that the system maintains. Over time, as edits are applied and the archive grows, the size of the underlying dataset will increase. When running cleanupChangeTracking, archived entries that are older than a specific date are removed thus reducing the size of the underlying dataset.

In ArcGIS Enterprise, the cleanupChangeTracking operation is available for hosted feature services running on a relational data store that have Sync capability enabled.

In ArcGIS Online, the cleanupChangeTracking operation is available for feature services that have the either the Sync or ChangeTracking capabilities enabled.

Prior to performing this operation, ensure hosted feature services are synced or that older replicas have been removed, including replicas that were not synced prior the start date or time in which archived entries will be removed.

Request parameters

ParameterDetails

layers

The list of layers and tables in which to run the operation.

Syntax
Use dark colors for code blocksCopy
1
layers=[<layer1>, <layer2>, <table1>]
Examples
Use dark colors for code blocksCopy
1
2
3
layers=0, 1, 2

layers=[0, 1, 2]

retentionPeriod

The period of time, starting from the current moment, in which archived information is maintained. Any changes in the archive that are older than the retention period will be removed. The units of time are defined by the retentionPerionUnits parameter.

Syntax
Use dark colors for code blocksCopy
1
retentionPeriod=<retentionPeriod>
Use dark colors for code blocksCopy
1
retentionPeriod=180

retentionPerionUnits

The units of time for the retentionPeriod.

Values: days | seconds | minutes | hours

minServerGen

Any changes made prior to the time specified by minServerGen will be removed from the archive. For ArcGIs Enterprise, the value for minServerGen is a Unix epoch date value in milliseconds (UTC).

Syntax
Use dark colors for code blocksCopy
1
minServerGen=<minServerGen>
Example
Use dark colors for code blocksCopy
1
2
//Monday, March 31st, 2025 3:38:21 AM UTC
minServerGen=1743392301000

replicaId

A replica ID. Changes for the replica specified in this parameter will be preserved, while all other changes will be removed.

async

This parameter specifies whether the operation will run synchronously or asynchronously. If false, the operation is run synchronously. If true, the operation is run asynchronously and the response returns a JSON object containing job information that can be used to track the job's status. The default value is false. Performing this operation asynchronously can accommodate longer running process, as will be the case where there are a lot of changes in the archive.

Values: true | false

f

The response format. The default format is html.

Values: html | json | pjson

Example usage

The following is a sample POST request for the cleanupChangeTracking operation:

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST /<context>/rest/admin/services/example/FeatureServer/cleanupChangeTracking HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

layers=0&retentionPeriod=15&retentionPeriodUnits=days&async=false&f=json

JSON Response examples

The following response is returned when async is false:

Use dark colors for code blocksCopy
1
2
3
{
  "success": true
}

When async is true, the request is processed as an asynchronous job and the response returns a URL that a client can use to check the job's status:

Use dark colors for code blocksCopy
1
2
3
{
  "statusUrl": "https://organization.example.com/<context>/rest/services/Hosted/myservice/FeatureServer/jobs/j085d6261-67b5-42fe-ba1b-41de4fa3903e"
}

The response below is returned from the status resource once the job has completed successfully:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "success": true,
  "operationName": "cleanupChangeTracking",
  "lastUpdatedTime": 1743396252860,
  "serviceName": "Hosted/volcano_roop",
  "submissionTime": 1743396250231,
  "status": "COMPLETED"
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.