Batch updating

Posted by / 14-Nov-2020 08:55

Batch updating

The body of a batch request MUST be made up of an ordered series of query operations and/or Change Sets.

A query operation in the context of a batch request is either a query or Function invocation request as described in [OData: Core].

If a MIME part representing an Insert request within a Change Set includes a Content-ID header, then the new entity represented by that part may be referenced by subsequent requests within the same Change Set by referring to the Content-ID value prefixed with a “$” character.

When used in this way, $POST /service/$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: 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/Customers HTTP/1.1 Host: host Content-Type: application/atom xml;type=entry Content-Length: ### --changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621 Content-Type: application/http Content-Transfer-Encoding: binary POST

The body of a batch request MUST be made up of an ordered series of query operations and/or Change Sets.

||

The body of a batch request MUST be made up of an ordered series of query operations and/or Change Sets.

A query operation in the context of a batch request is either a query or Function invocation request as described in [OData: Core].

If a MIME part representing an Insert request within a Change Set includes a Content-ID header, then the new entity represented by that part may be referenced by subsequent requests within the same Change Set by referring to the Content-ID value prefixed with a “$” character.

When used in this way, $POST /service/$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: 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/Customers HTTP/1.1 Host: host Content-Type: application/atom xml;type=entry Content-Length: ### --changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621 Content-Type: application/http Content-Transfer-Encoding: binary POST $1/Orders HTTP/1.1 Host: host Content-Type: application/atom xml;type=entry Content-Length: ### Requests within a batch MUST be evaluated according to the same semantics used when the request appears outside the context of a batch.

Batch requests allow grouping multiple operations, as described in [OData: Core], into a single HTTP request payload.

A batch request MUST be represented as a Multipart MIME v1.0 message [RFC2046], a standard format allowing the representation of multiple parts, each of which may have a different content type (as described in [OData: Atom], [OData: JSON] and [OData: JSONVerbose]), within a single request.

/Orders HTTP/1.1 Host: host Content-Type: application/atom xml;type=entry Content-Length: ### Requests within a batch MUST be evaluated according to the same semantics used when the request appears outside the context of a batch.

Batch requests allow grouping multiple operations, as described in [OData: Core], into a single HTTP request payload.

A batch request MUST be represented as a Multipart MIME v1.0 message [RFC2046], a standard format allowing the representation of multiple parts, each of which may have a different content type (as described in [OData: Atom], [OData: JSON] and [OData: JSONVerbose]), within a single request.

Unless otherwise specified, the contents of this document is defined as part of OData version 1.

The OData protocol defines a way to query and manipulate data (described using an EDM model) using a simple set of operations.

This document builds on the ‘Interaction Semantics’ section of the core OData specification document and describes how an OData implementation MAY support executing multiple operations sent in a single HTTP request through the use of Batching.

Structurally, a batch response body MUST match one-to-one with the corresponding batch request body, such that the same multipart MIME message structure defined for requests is used for responses.

The exception to this rule is that when a request within a Change Set fails, the Change Set response is not represented using the multipart/mixed media type.

batch updating-3batch updating-33batch updating-23

If the set of request headers of a Batch request are valid (the Content-Type is set to multipart/mixed, etc) the service MUST return a 202 Accepted HTTP response code to indicate that the request was accepted for processing, but the processing yet to be completed.