+ Start a Discussion
Jeff BenjaminJeff Benjamin 

How to upsert multiple records with REST

I need to upsert multiple records of the same type/object with one REST API call. 

I see how to upsert one record (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm), but not how to upsert multiple. 

With the composite resources I see how to update or insert multiple records, but not how to upsert.

Is it possible to upsert multiple records? 
 
Daniel BallingerDaniel Ballinger
I've looked into this in the past. See Choose Your Own Adventure - Dirty Dozen showdown with the REST API vs SOAP API vs BULK API (http://www.fishofprey.com/2017/01/choose-your-own-adventure-dirty-dozen.html)

It really depends on how many records you have and if it can be asynchronous. If you can, the Bulk API will be the most efficent way to do this.

Also keep an eye on the Simplified Job Process for Bulk API 2.0 (Pilot) (https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_api_bulk.htm#rn_api_bulk_v2_pilot). With a cut down number of API calls the Bulk API would be the fastest option.

You might also like to vote on the idea: Allow REST API composite batch subrequests to be processed in one transaction (https://success.salesforce.com/ideaView?id=0873A000000COZYQA4)