Get a Record Using an External ID
You can use the GET method of the sObject Rows by External ID resource to get records with a specific external ID.
The following example assumes there is a Merchandise__c custom object with a MerchandiseExtID__c external ID field.
- Example usage for retrieving a Merchandise__c record using an external ID
-
curl https://MyDomainName.my.salesforce.com/services/data/v64.0/sobjects/Merchandise__c/MerchandiseExtID__c/123 -H "Authorization: Bearer token"
- Example request body
- none required
- Example response body
-
{ "attributes" : { "type" : "Merchandise__c", "url" : "/services/data/v64.0/sobjects/Merchandise__c/a00D0000008oWP8IAM" }, "Id" : "a00D0000008oWP8IAM", "OwnerId" : "005D0000001KyEIIA0", "IsDeleted" : false, "Name" : "Example Merchandise", "CreatedDate" : "2012-07-12T17:49:01.000+0000", "CreatedById" : "005D0000001KyEIIA0", "LastModifiedDate" : "2012-07-12T17:49:01.000+0000", "LastModifiedById" : "005D0000001KyEIIA0", "SystemModstamp" : "2012-07-12T17:49:01.000+0000", "Description__c" : "Merch with external ID", "Price__c" : 10.0, "Total_Inventory__c" : 100.0, "Distributor__c" : null, "MerchandiseExtID__c" : 123.0 }