Salesforce Composite resources

Use REST API composite resources are helpful to improve application’s performance by minimizing the number of round-trips between the client and server.

All the series of rest apis are counted as a single call towards your API limits. This is executed in the context of the same user.

  1. Series of REST API requests in a single call.

  2. Multiple CRUD Operations

  3. Output of one request as the input to a subsequent request.

  4. Response bodies and status in a single response body.

  5. Counts as a single call toward your API limits.

  6. Executed in the context of the same user.

Composite request body

Here you are seeing an example of a composite request body

{
   "allOrNone" : true,
   "collateSubrequests": true,
   "compositeRequest" : [
     { Composite Subrequest},
     { Composite Subrequest},
     { Composite Subrequest}
   ]
}

Composite request response

{
   "compositeResponse" : [
      {  Composite Subrequest Result },
      {  Composite Subrequest Result },
      {  Composite Subrequest Result }
   ]
}

Type of Composite Resources

There are different composite resources available

  1. Composite API

  2. Batch

  3. SObject Tree

  4. SObject Collection

  5. Grapths