I have a small collection of records that I want to update in Salesforce via the REST API. Say a dozen OpportunityLineItem records.
If I use a composite batch request
with 12 subrequests then I get 12 different transactions to make the changes to each OpportunityLineItem individually. This results in the triggers and workflows all executing independently for 12 isolated transactions. 12 times the before triggers, 12 times the SOQL queries, 12 times the workflows, ...
I need a way to update this small set of records within a single transaction so the triggers can work on the records in bulk.
The Bulk API isn't a good option here due to its asynchronous nature. The user is waiting for these records to be updated and I'd prefer to avoid polling for the bulk job to finish.
Creating a dedicated Apex REST API is an option, but I'd prefer not to have to maintain a method for each small collection of records that need to be updated.
The SOAP API isn't a great option as the rest of the application is using the REST API.