Sync supports options for asynchronous processing with the createReplica and synchronizeReplica operations. The following example illustrates the usage of an asynchronous operation.
Asynchronous processing with synchronize Replica
Synchronizing a replica with the async
parameter set to true
returns a location to a status resource in the status
.
JSON Response syntax
{
"statusURL": "<url>"
}
JSON Response example
{
"statusUrl": "https://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/FeatureServer/jobs/jf90d6386f7494cd59c024f749773fe7b"
}
Status responses
The status resource includes the current status of the process as well as the replica name, the process start time, and the last time a status update was provided. If the status is anything other than Completed
, Completed
, or Failed
, the client can call Get
on the resource for a status update.
When the status is Completed
, the resource includes the results in a result
. A result
is provided even if the operation was called with the transport
parameter set to esri
.
The following shows JSON request and response examples and syntax for the status resource.
JSON Request example
https://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/FeatureServer/createReplica/26bba818-15f7-47b5-9ae3-f6f9a7b781ed?statusId=26bba818-15f7-47b5-9ae3-f6f9a7b781ed
JSON Response syntax
{
"transportType": "esriTransportTypeURL",
"responseType": "<esriReplicaResponseTypeData | esriReplicaResponseTypeInfo>",
"replicaName": "<Name>",
"resultUrl": "<result Uri>",
"submissionTime": <T1>, //Time since epoch in milliseconds
"lastUpdatedTime" : <T2>, //Time since epoch in milliseconds
"status": "<Pending | InProgress | Completed | Failed ImportChanges | ExportChanges | ExportingData | ExportingSnapshot | ExportAttachments | ImportAttachments | ProvisioningReplica | UnRegisteringReplica | CompletedWithErrors>"
}
JSON Response examples
The following is a sample response where status
is returned as In
:
{
"transportType": "esriTransportTypeURL",
"responseType": "esriReplicaResponseTypeData",
"replicaName": "MyReplica",
"resultUrl": "",
"submissionTime": 1379366893000,
"lastUpdatedTime": 1379366896000,
"status": "InProgress"
}
The following is a sample response where status
is returned as Completed
:
{
"transportType": "esriTransportTypeURL",
"responseType": "esriReplicaResponseTypeData",
"replicaName": "MyReplica",
"resultUrl": "https://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/replicafiles/e75aaca03a6d46a98c9b3986bc625b78.json",
"submissionTime": "1335205911000",
"lastUpdatedTime": "1335206031000",
"status": "Completed"
}