These are notes about Composite, Composite Graph and sObject Tree APIs that I made while studying for the Integration Architect certification. Other articles are here.
Composite API
(URI: /vXX.X/composite)
Executes a series of REST API requests in a single call and the output of one request can be the input to a subsequent request. The response bodies and HTTP statuses of request are returned together in one response body. Each full composite API request (including its subrequests) counts as a single call toward your API limits. The request and its subrequests are all executed in the context of the same user. You can only have up to 25 requests per single call using Batch (URI: /vXX.X/composite/batch).
Composite Graph API
(URI: /vXX.X/composite/graph)
A composite graph is defined in JSON.
Composite graphs are an enhanced way to perform composite requests. Rather than a limit of 25 requests in a single composite API call, it is possible to have up to 500. Like composite requests composite graph executes REST API requests in a single call. It is possible, in a composite graph, to assemble complicated and complete series of records and related objects. The Composite graph ensures that all steps in a set of operations are all completed or not. One advantage of this is that it is not necessary to unpack a mix of successful and unsuccessful results. Best practice therefore is to carry out small graphs. If one item fails – all are rolled back.
sObject tree
(URI: /v.XX.X/composite/tree)
This can be used to create multiple records of the same type, or nested records. In a single request it is possible to create up to 200 unrelated records of the same type. For nested records, in a single request you can create an account (for example) that is the root record type and then create its child accounts and contacts. The parent records and child records are automatically linked by their ID when they are processed. The response body will contain the created records’ ID if it is successful or the reference ID(s) of the record(s) that caused the error and the related error information.