Newer Version Available

This content describes an older version of this product. View Latest

Batch

Executes up to 25 subrequests in a single request to improve your application’s performance. The response bodies and HTTP statuses of the subrequests in the batch are returned in a single response body. Each subrequest counts against rate limits. Use this resource to minimize the number of round-trips between the client and server.

The requests in a batch are called subrequests. All subrequests are executed in the context of the same user. Subrequests are independent, and you can’t pass information between them. Subrequests execute serially in their order in the request body. When a subrequest executes successfully, it commits its data. Commits are reflected in the output of later subrequests. If a subrequest fails, commits made by previous subrequests are not rolled back.

The Batch resource supports batching for the following resources and resource groups.
Versions
/
Resources by Version
vXX.X
Limits
vXX.X/limits
SObject resources
vXX.X/sobjects/
Query
vXX.X/query/?q=soql
QueryAll
vXX.X/queryAll/?q=soql
Search
vXX.X/search/?q=sosl
Connect resources
vXX.X/connect/
Chatter resources
vXX.X/chatter/

If a batch request doesn’t complete within 10 minutes, the batch times out and the remaining subrequests aren’t executed.

URI
/vXX.X/composite/batch
Formats
JSON, XML
HTTP method
POST
Authentication
Authorization: Bearer token
Parameters
None required
Request body
Batch Request Body
Response body
Batch Response Body
Examples
For an example of using the Batch resource, see Update a Record and Get Its Field Values in a Single Request.