Newer Version Available

This content describes an older version of this product. View Latest

SObject Rows by External ID

Creates new records or updates existing records (upserts records) based on the value of a specified external ID field.

  • If the specified value doesn't exist, a new record is created.
  • If a record does exist with that value, the field values specified in the request body are updated.
  • If the value is not unique, the REST API returns a 300 response with the list of matching records.

Do not specify Id or an external ID field in the request body or an error is generated.

Note

URI
/vXX.X/sobjects/SObjectName/fieldName/fieldValue
Formats
JSON, XML
HTTP Method
HEAD, GET, PATCH, DELETE, POST (see Usage section)
Authentication
Authorization: Bearer token
Parameters
None
Usage
As a special case, in API version 37.0 and later, you can use this resource to create a record by POSTing to /vXX.X/sobjects/SObjectName/Id. This pattern represents the use of Id as the specified external ID field and null as the value. It’s useful when you’re writing code to upsert multiple records by different external IDs and you don’t want to request a separate resource.
Examples