What is the maximum number of records I can send per RESTful API call?
If you are using the standard endpoints, such as POST /vXX.X/sobjects/Account
or PATCH /vXX.X/sobjects/Account/id
, then yes, you can only create or update one at a time.
The bulk API, or even the SOAP API, can be used to upload multiple objects at the same time.
You can also create your own APEX REST endpoint. As an example:
@RestResource(urlMapping='/test/*')
global with sharing class TestRestController{
global class RequestBody {
global List<Account> accounts;
}
@HttpPost
global static List<Account> createBulk(TestRestController.RequestBody req) {
insert req.accounts;
return req.accounts;
}
}
You can then post to that endpoint the following data, and get back full data about the created Account objects.
POST https://[instance].salesforce.com/services/apexrest/test/
{
"req" : {
"accounts": [{"name": "test1"},{"name" : "test2"}]
}
}
Using a custom endpoint would be subject to the normal governor limits including a maximum request and response size of 3MB.
Using "patch", the limit is 1. That's because this API is really intended for mobile devices, of which you'll usually be working with one record at a time. Also, it's considered the RESTful design, embedding the id into the URI, and using HTTP verbs to manipulate data.
There are alternatives, though. You could use the REST Bulk API to make a batch you can upload in pieces. You could write your own custom REST API functions to handle multiple records.
And, of course, you could fallback to SOAP for those times when you want synchronous multiple updates, as session tokens are interchangeable.