Newer Version Available

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

Create Records Using sObject Rows by External ID

Creates a new record based on the field values included in the request body. This resource does not require the use of an external ID field.

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

Note

For security reasons, some Top Level Domains (TLD) may conflict with certain file format extensions. Adjust your implementation to work around such cases. For example, when an email address is used as the External ID in the request URL, and the TLD ".inc" is used as part of the field value, the request returns a “404 not found” error.

For example,

returns a “404 not found” error.

Workarounds:

  • Use a different External ID field.
  • Create a new External ID field that is the same as the email field and replace the "." with an "_" to handle this case.
  • Run a query for emails ending in ".inc" to retrieve the record ID and use that for the upsert.
  • Use SOAP API instead of REST API for upsert operations.
  • Accept the email as a query parameter instead of a path parameter by creating a custom Apex REST API. Use Apex to perform the upsert operation.

Note

URI
/services/data/vXX.X/sobjects/sObjectName/Id
Formats
JSON, XML
HTTP Method
POST
Authentication
Authorization: Bearer token
Parameters
None
Usage

As a special case, in API version 37.0 and later, you can create a record with a POST request to /services/data/vXX.X/sobjects/sObjectName/Id. Because Id has a null value, it is omitted from the request, and the record is created according to the request body. Creating records with this resource is useful because you can use the same URI in each POST request for each new record. In this case, you are not required to specify an external ID to create a record.