Update Contact Records Using REST API
You can update records using the sObjects rows endpoints in REST API.
You can use REST API to update the record types shown in this table.
Record Type | API Name |
---|---|
Contact records | Contact |
Campaigns | Campaign |
Before you send a request to REST API, obtain a bearer token. For more information, see Connect to REST-based APIs.
To update a record, send a PATCH request to the /data/v61.0/sobjects/OBJECT_API_NAME/RECORD_ID
endpoint. Replace OBJECT_API_NAME
with the API name of the type of object that you want to update, and replace RECORD_ID
with the unique ID of the record to update. To find IDs for the records that you want to update, run a query.
The body of the request is a JSON object that contains the information that you want to update for the object. This example changes the value of the MobilePhone
property for a contact.
The field names that you specify in the request body must exactly match the field names in the target object. You can retrieve a list of field names and relationships by issuing a GET call to the /services/data/v61.0/sobjects/OBJECT_API_NAME/describe
endpoint. Alternatively, you can view a list of fields and relationships in the Object Explorer on the Setup page of the Salesforce web app.
Fields that are already present in the record but not specified in the request are unchanged. If a field in the request body doesn’t exist in the target object, the request fails with an error.
If the request is successful, the response contains a JSON object with a complete list of fields and values for the updated record.
For more information and code examples, see updateContact.