While coming up with a solution design for an API integration piece for work I found the REST API batch resource feature relevant to my use case. The feature has been around since Summer 2015 and I didn’t know much about it then. Basically the batch resource allows you to make multiple request in a single API call.
I needed to come up with a simple solution for creating a single record and has option to pass an array of records to be created. I initially had been looking at 3 options and listed the things to consider on the development side.
- REST API via the sobject resource
- use sobject resource for record creation
- no Apex code
- cannot do array
- Apex Rest API
- accepts an array of the records
- use of JSON parser and deserializing the request body
- create test classes
- Bulk API
- last option
- overkill for the job and too many things to consider to get the integration setup