Comparison of Salesforce REST API Composite Resources (Video 8:18)
This video is an extraction from our course #Mastering Salesforce APIs, where we compare the different REST APIs provided by Salesforce.
Do you know that if you choose the right Salesforce API, you can potentially save up to 499 API calls? That will be some performance and governor limit gains if you just know what the right API will be to use.
In one of the projects that I was involved in, there was a requirement to create 3 levels of parent-child records. Record 1 will be the parent of record 2, which in turn will be the parent of record 3.
Ignorant of the full landscape of REST APIs that Salesforce provides, the team's initial design was to make three API calls. Create record 1, get the record ID, create record 2, get the record ID, and then create record 3.
And then they were introduced to the Composite API that Salesforce provides, where we could achieve the same requirement with just a single call.
If you are not already aware, there are a few different flavors of composite resources that Salesforce offers.
We have APIs that execute a single request and operate on a single record (non-composite), and then there are five different composite resources, each with its own nuances, capabilities, pros and cons.
They are:
Composite API
Composite Graph API
Composite Batch API
sObject Tree API
sObject Collections API
But there wasn't an easy way to identify what the differences are between these APIs (at least not before this blog post 😉). How do they stack against each other? What can and can't they do? Which one should be used when?
Hence, this blog post with a video that hopefully will give you some clarity on the capabilities and differences of these APIs and will help you make the right decision.
What the Video Compares
Supported operations, multiple records and parent-child inserts
Passing the output of one subrequest into another
Request and record limits per call, and API limit consumption
Subrequest depth and sObject Tree nesting levels
Error handling and rollback (allOrNone)
Endpoints for each resource