I have a client calling various SF REST APIs.

So far so good. Unfortunately (and inexplicably in my opinion), object create, update, and delete operations can handle 1 object per REST API request, however, which has some serious drawbacks (e.g. unnecessary network chatter/latency for each object, inability to do everything in 1 transaction, etc).

I don't want to have to create custom services in SalesForce -- as the client should be generic to any SalesForce installation. And I don't want to rewrite everything in SOAP -- REST is much more appropriate overall.

Is there a way I can just make multi-object create, update, and delete calls from my REST client, e.g. using bare-bones SOAP calls for precisely these calls and passing the access token already established for the REST calls?

I really don't get why these capabilities are excluded from the REST API itself.


You could make use of the new batch resource that was added in Summer 15.


The Batch resource lets you execute a sequence of independent subrequests. For example, you can update the name on an account and get the account’s field values in a single request.

    "batchRequests" : [
    "method" : "PATCH",
    "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ",
    "richInput" : {"Name" : "NewName"}
    "method" : "GET",
    "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ"

The response contains the status codes of each subresponse and the responses themselves.

 "hasErrors" : false,
 "results" : [
    "statusCode" : 204,
    "result" : null
    "statusCode" : 200,
    "result" : { Account attributes }
| improve this answer | |

You should be able to. Here's a excerpt from the REST API documentation

Upserting Records and Associating with an External ID

If you have an object that references another object using a relationship, you can use REST API to both insert or update a new record, and also reference another object using an external ID.

The following example creates a new record and associates it with a parent record via external ID.

It assumes the following: A Merchandise__c custom object that has an external ID field named MerchandiseExtID__c.

A Line_Item__c custom object that has an external ID field named LineItemExtID__c, and a relationship to Merchandise__c.

A Merchandise__c record exists that has a MerchandiseExtID__c value of 123.

A Line_Item__c record with a LineItemExtID__c value of 456 does not exist. This is the record that will get created and associated to the Merchandise__c record.


Your other option is to use the Bulk REST API, which is discussed in another thread: INSERTING MULTIPLE RECORDS USING SALESFORCE REST API

| improve this answer | |
  • But if I (1) have no knowledge of an external id [again, this is to be generic] and (2) want to do this to multiple objects in one call to SalesForce, ideally as 1 all-or-nothing transaction, how does upsert solve anything for me? Upsert is still a single-object API in SF REST. As for the bulk API, I want synchronous creation of multiple records here. – Jess Holle May 5 '15 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.