Batch Requests

Batch requests allow grouping of multiple individual requests into a single HTTP request payload.

An individual request in the context of a batch request can be a:

Format of a Batch Request

Important parts in a Batch Payload

Important parts in a Batch Payload

Figure 1 - Important parts in a batch payload

Individual requests and Change Sets are the main contents of a batch request. Change Set is a concept which allow you to bundle couple of requests that needs to be processed in a transactional way. Either all of the request parts in a change set are processed successfully or nothing is committed at all.

Note! GET requests can not be specified inside a Change Set.

Referencing Created Entity & ETag

Referencing Created Entity & ETag

Figure 2 - Referencing a created entity and ETag

The $-sign with a Content-Id header value can be used to refer previously created resource or ETag of the resource. See Figure 2.

In this example $1 is used as the resource, it refers to the resource created by the request part which has 1 as Content-Id header value. Also an ETag value of that resource is referred when $1 is specified in the If-Match header.

Execution of a Batch Request

Request parts inside a batch request are processed sequentially as depicted in Figure 3.

Execution of a Batch Request

Figure 3 - Execution of a batch request

Continuing on Errors

What if it is necessary to continue an execution, even if a request part fails? It is possible to specify this need in the Prefer header of the batch request as shown in Figure 4.

Continuing on Errors

Figure 4 - Continuing on errors

For more details about batch requests please follow this link.