skip to main content
Formulating queries : Creating, editing, and deleting records : Update example
 

Try DataDirect Cloud 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, service.datadirectcloud.com/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 .
DDC 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)