Asynchronous operations

Sync supports options for asynchronous processing with the createReplica and synchronizeReplica operations. The following example illustrates the usage of an asynchronous operation.

Example: Asynchronous processing with synchronizeReplica

Synchronizing a replica with the async parameter set to true returns a location to a status resource in the statusUrl.

JSON response syntax

{
  "statusURL: "<url>"
}

JSON response example

{
  "statusUrl": "http://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/FeatureServer/jobs/jf90d6386f7494cd59c024f749773fe7b"
}

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, CompletedWithErrors, 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 resultUrl. A resultUrl is provided even if the operation was called with the transportType parameter set to esriTransportTypeEmbedded.

The following shows JSON request and response examples and syntax for the status resource.

JSON request example

GET http://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 example (InProgress status)

{  
   "transportType": "esriTransportTypeURL",
   "responseType": "esriReplicaResponseTypeData",
   "replicaName" : "MyReplica",
   "resultUrl" : "", 
   "submissionTime " : 1379366893000,
   "lastUpdatedTime"  : 1379366896000,
   "status" : "InProgress"
}

JSON response example (Completed status)

{  
   "transportType": "esriTransportTypeURL",
   "responseType": "esriReplicaResponseTypeData",
   "replicaName" : "MyReplica", 
   "resultUrl" :  "http://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/replicafiles/e75aaca03a6d46a98c9b3986bc625b78.json",
   "submissionTime " : "1335205911000",
   "lastUpdatedTime"  : "1335206031000",
   "status" : "Completed"
}

9/13/2017