skip to main content
Querying with OData Version 2 : Formulating queries with OData Version 2 : Creating, editing, and deleting records with OData Version 2 : Update example
  

Try Now
Update example
To update a record, use a POST request with the custom X-HTTP-Method header. Supply the primary key in the resource URL and the property value(s) for the column(s) to update in the body. The following screen shows a request in Postman to update an account name from Hot Diggity Dog to Hot Diggity Dogs in a Salesforce data store. To formulate the request:
*The Content-Type header value is application/atom+xml.
*The custom header X-HTTP-Method value is MERGE.
*The URL includes:
*The service root, <myserver>:<port>/api/odata.
*The Data Source definition name, sfds.
*The plural entity name, ACCOUNTS followed by the primary key, 001i000001mDKrJAAW (which is cut off in the screen shot).
*The body includes:
*The value of the entry element and structure of the m:property element were copied from the response of a GET request that fetched a single account record.
*A value of Hot Diggity Dogs for the SYS_NAME property .
odata update ACCOUNT record example
The Status value 204 No Content shown in the screen above indicates that the name was successfully updated. A fetch of the record confirms the update to Hot Diggity Dogs as shown below: DDC OData - Update account record successful
For more information on updating, see HTTP POST and MERGE (update)