Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Update a Record and Get Its Field Values in a Single Request

Use the Composite Batch resource to execute multiple requests in a single API call.

The following example updates the name on an account and gets some of the account’s field values in a single request. The batch.json file contains the subrequest data.

Update a record and query its name and billing postal code in a single request

1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/composite/batch/ -H "Authorization: Bearer token -H "Content-Type: application/json" -d "@batch.json"

Request body batch.json file

1{
2"batchRequests" : [
3    {
4    "method" : "PATCH",
5    "url" : "v67.0/sobjects/account/001D000000K0fXOIAZ",
6    "richInput" : {"Name" : "NewName"}
7    },{
8    "method" : "GET",
9    "url" : "v67.0/sobjects/account/001D000000K0fXOIAZ?fields=Name,BillingPostalCode"
10    }]
11}

Response body after successfully executing the subrequests

1{
2   "hasErrors" : false,
3   "results" : [{
4      "statusCode" : 204,
5      "result" : null
6      },{
7      "statusCode" : 200,
8      "result": {
9         "attributes" : {
10            "type" : "Account",
11            "url" : "/services/data/v67.0/sobjects/Account/001D000000K0fXOIAZ"
12         },
13         "Name" : "NewName",
14         "BillingPostalCode" : "94105",
15         "Id" : "001D000000K0fXOIAZ"
16      }
17   }]
18}