I have written an apex class for inserting records into salesforce.Is it possible for me to implement the 'Upsert' functionality through a REST API in salesforce?

  • What have you tried? Are you encountering errors? You should make an attempt before asking here. At face value the answer seems to be yes.
    – Adrian Larson
    Feb 17 '16 at 17:10
  • You mean upsert a record using REST API outside of Salesforce ? Feb 17 '16 at 17:10
  • what is your external system language ?
    – Himanshu
    Feb 17 '16 at 17:11
  • The main difference between Insert and Upsert is, you need an External ID beyond ID in Salesforce object

  • Assuming that External Field is X, your request would look like:

curl https://na1.salesforce.com/services/data/v20.0/sobjects/MyObject__c/X__c/999999 -H "Authorization: Bearer token" -H "Content-Type: application/json" -d @updates.json -X PATCH

Where @updates.json contains other data pieces of your object

  { "field1" : "d1", .... ,"fieldn","dn"}


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.