The REST API docs on update records seem to indicate that it is possible to update multiple records with a PATCH call, but does not provide a concrete examples of how to do so. The doc says:
Provide the updated record information in your request data and use the PATCH method of the resource with a specific record ID to update that record. Records in a single file must be of the same object type.
Searching google and SFSE I see references to using the composite resource for bulk operations, with a concrete example here.
So my question, in two parts
is it possible to update multiple records using a patch call?
if so, can i serialize a list of sObjects using
JSON.serialize
or do i need to build my own JSON?if not, can I serialize a list of sObjects and pass them to the composite resource?
So far I've been unable to do anything (trying to call salesforce api from apex to update currencyType records), and not sure if i'm dealing with the POST/PATCH issues or if im just not hitting the right endpoint or have the wrong file structure.
debug log shows:
14:24:17:349 CALLOUT_REQUEST [111]|System.HttpRequest[Endpoint=https://cs13.salesforce.com/services/data/v41.0/sobjects/CurrencyType?_HttpMethod=PATCH, Method=POST]
14:24:17:394 CALLOUT_RESPONSE [111]|System.HttpResponse[Status=Method Not Allowed, StatusCode=405]
UPDATE : here is a snippet of the request body. I'm serializing a list of CurrencyType
sObjects
[{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L400000002ASiEAM"},"Id":"01L400000002ASiEAM","IsoCode":"AED","ConversionRate":3.672611,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L40000000V05bEAC"},"Id":"01L40000000V05bEAC","IsoCode":"AFN","ConversionRate":68.671,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L400000002ABhEAM"},"Id":"01L400000002ABhEAM","IsoCode":"ARS","ConversionRate":17.5205,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L40000000V08pEAC"},"Id":"01L40000000V08pEAC","IsoCode":"AUD","ConversionRate":1.27665,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L400000002ADJEA2"},"Id":"01L400000002ADJEA2","IsoCode":"BDT","ConversionRate":82.808961,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L40000000ZCJiEAO"},"Id":"01L40000000ZCJiEAO","IsoCode":"BHD","ConversionRate":0.379507,"IsActive":true},{"attributes":{"type":"CurrencyType","url":"/services/data/v41.0/sobjects/CurrencyType/01L400000002ABmEAM"},"Id":"01L400000002ABmEAM","IsoCode":"BOB","ConversionRate":7.007198,"IsActive":true}