2.2.7.6.5 Example Batch Request
This section shows an example Batch request that contains the following operations in the order described:
A change set that contains the following requests:
InsertEntity Request (with Content-ID = 1)
Insert Entity (references request with Content-ID = 1)
A second query operation
Legend:
Request bodies are excluded in favor of English descriptions inside "<>" brackets to simplify the example
POST /service.svc/$batch HTTP/1.1 Host: host Content-Type: multipart/mixed; boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77b --batch_36522ad7-fc75-4b56-8c71-56071383e77b Content-Type: application/http Content-Transfer-Encoding:binary GET /service.svc/Customers('ALFKI') Host: host --batch_36522ad7-fc75-4b56-8c71-56071383e77b Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621 Content-Length: ### --changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621) Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 1 POST /service.svc/Customers HTTP/1.1 Host: host Content-Type: application/atom+xml;type=entry Content-Length: ### <AtomPub representation of a new Customer> --changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621) Content-Type: application/http Content-Transfer-Encoding: binary Content-ID: 2 POST $1/Orders HTTP/1.1 Host: host Content-Type: application/atom+xml;type=entry Content-Length: ### <AtomPub representation of a new Order> --changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621) Content-Type: application/http Content-Transfer-Encoding:binary Content-ID: 3 PUT /service.svc/Customers('ALFKI') HTTP/1.1 Host: host Content-Type: application/json;odata=verbose If-Match: xxxxx Content-Length: ### <Verbose JSON representation of Customer ALFKI> --changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621)-- --batch(36522ad7-fc75-4b56-8c71-56071383e77b) Content-Type: application/http Content-Transfer-Encoding:binary GET service.svc/AnEntitySetWhichDoesNotExist HTTP/1.1 Host: host --batch(36522ad7-fc75-4b56-8c71-56071383e77b)--