5.3 Updating Synchronization Target
The synchronization engine will then POST the synchronization feed to the target endpoint:
POST /sdata/myApp2/myContract/-/accounts/$syncTarget?trackingId=B2419115-DD2E-4d5a-9E8E-90E012AFE89C&runName=Full%20CRM%20to%20ERP&runStamp=2009-10-14T08:51:02 HTTP/1.1 Content-Type: application/atom+xml; type=feed <!-- Synchronization feed obtained from the source -->
The target application will process this request like an asynchronous batch request (<httpMethod> elements give the method to apply to each entry). The <digest> and <syncState> elements will allow the target application to detect and handle conflicts (see Conflict Resolution section later).
Like any asynchronous SData operation, the POST request will return a 202 Accepted response until the batch has been processed:
202 Accepted Location: http://www.example.com/sdata/myApp1/myContract/-/accounts/$syncTarget('B2419115-DD2E-4d5a-9E8E-90E012AFE89C') <?xml version="1.0" encoding="utf-8"?> <tracking xmlns="http://schemas.sage.com/sdata/2008"> <phase>Initialization</phase> <phaseDetail>Starting batch</phaseDetail> <progress>0.0</progress> <elapsedSeconds>0</elapsedSeconds> <remainingSeconds>20</remainingSeconds> <pollingMillis>500</pollingMillis> </tracking>
The engine will perform a GET on the Location URL (http://www.example.com/sdata/myApp1/myContract/-/accounts/$syncTarget(‘B2419115-DD2E-4d5a-9E8E-90E012AFE89C’)) until it gets a 200 HTTP status. At this time the target has finished processing the entries of the feed and the engine will get a response like:
200 OK Content-type: application/atom+xml; type=feed <feed xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:http="http://schemas.sage.com/sdata/http/2008/1" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2005/Atom"> <id>/sdata/myApp2/myContract/-/accounts/$syncTarget</id> <title>Synchronization Feed</title> <updated>2008-03-31T13:46:45Z</updated> <entry> <id>http://www.example.com/sdata/myApp2/myContract/-/accounts('28004')</id> <title>Account Natural Goods</title> <updated>2008-03-31T13:46:45Z</updated> <link rel="self" type="application/atom+xml; type=entry" title="Refresh" href="http://www.example.com/sdata/myApp2/myContract/-/accounts('28004')" /> <content>Natural Goods Ltd.</content> <http:httpStatus>200</http:httpStatus> <http:httpMessage>OK</http:httpMessage> <http:location>http://www.example.com/sdata/myApp2/myContract/-/accounts('28004')</http:location> <http:httpMethod>POST</http:httpMethod> <http:etag>2nXz9DZYR2pqmcXi/ZCbYA==</http:etag> <!-- payload for created account --> </entry> <entry> <id>http://www.example.com/sdata/myApp2/myContract/-/accounts('27483')</id> <title>Account Chemical Bros</title> <updated>2008-03-31T13:46:45Z</updated> <link rel="self" type="application/atom+xml; type=entry" title="Refresh" href="http://www.example.com/sdata/myApp2/myContract/-/accounts('27483')" /> <content>Chemical Bros</content> <http:httpStatus>200</http:httpStatus> <http:httpMessage>OK</http:httpMessage> <http:httpMethod>PUT</http:httpMethod> <http:etag>STFtZgHEkPz7TyH98YEmWA==</http:etag> <!-- payload for updated account --> </entry> <!-- more entries --> </feed>
The engine will then delete the batch context:
DELETE /sdata/myApp2/myContract/-/accounts/$syncTarget('B2419115-DD2E-4d5a-9E8E-90E012AFE89C') HTTP/1.1
The target service will respond to this DELETE request with:
200 OK
A provider exposing a $syncTarget URL for resource kind MUST support asynchronous calls as well as the sequential paging mechanism for retrieving the operation results.
The invoker of a POST operation on the $syncTarget URL of a result SHOULD invoke a DELETE operation for every POST operation performed.