Newer Version Available

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

Batch

Executes up to 25 subrequests in a single request. 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.

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. If a batch request doesn’t complete within 10 minutes, the batch times out and the remaining subrequests aren’t executed.

Batching for the following resources and resource groups is available in API version 34.0 and later.
  • 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/
Batching for the following resources and resource groups is available in API version 35.0 and later.
  • Actions—vXX.X/actions

The API version of the resource accessed in each subrequest must be no earlier than 34.0 and no later than the Batch version in the top-level request. For example, if you post a Batch request to /services/data/v35.0/composite/batch, you can include subrequests that access version 34.0 or 35.0 resources. But if you post a Batch request to /services/data/v34.0/composite/batch, you can only include subrequests that access version 34.0 resources.

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.