Composite
POST {{_endpoint}}/services/data/v{{version}}/composite/
Executes a series of REST API requests in a single call. You can use the output of one request as the input to a subsequent request. The response bodies and HTTP statuses of the requests are returned in a single response body. The entire request counts as a single call toward your API limits. The requests in a composite call are called subrequests. All subrequests are executed in the context of the same user. In a subrequest’s body, you specify a reference ID that maps to the subrequest’s response. You can then refer to the ID in the url or body fields of later subrequests by using a JavaScript-like reference notation.
Request Body
{"compositeRequest"=>[{"method"=>"POST", "url"=>"/services/data/v{{version}}/sobjects/Account", "referenceId"=>"refAccount", "body"=>{"Name"=>"Sample Account"}}, {"method"=>"POST", "url"=>"/services/data/v{{version}}/sobjects/Contact", "referenceId"=>"refContact", "body"=>{"LastName"=>"Sample Contact", "AccountId"=>"@{refAccount.id}"}}]}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"compositeResponse":[{"body":{"id":"001...","success":true,"errors":[]},"httpHeaders":{"Location":"/services/data/v53.0/sobjects/Account/001..."},"httpStatusCode":201,"referenceId":"refAccount"},{"body":{"id":"0032o00003WauzJAAR","success":true,"errors":[]},"httpHeaders":{"Location":"/services/data/v53.0/sobjects/Contact/003..."},"httpStatusCode":201,"referenceId":"refContact"}]}