In this blog, I am going to explain salesforce rest API composite resource which is designed to reduce the number of round trips to the server. A composite API is a sequence of tasks that run synchronously and Composite API is built by combing the existing API functions that can perform the multiple tasks in the single call. Salesforce composite resources contain Composite, Tree, batch resources.
A composite API may be used :
- To speed up the execution of a sequence of tasks instead of making separate calls
- To compose an API by creating a sequence of web services
- Composite API run synchronously
Salesforce provides three composite resources namely composite, batch, tree
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.
composite/batch/: Execute a set of subrequests in a single request. Subrequests are executed independently and information can’t be passed between subrequest calls.
composite/tree/: Creates one or more sObject trees with root records of the specified type. An sObject tree is a collection of nested, parent-child records with a single root record.