I am using a service with an OData database. I am able to perform various actions through Http requests, i.e. insert new rows into a table by using POST, retrieve rows by using GET, and I can delete rows by using DELETE. However, is there a way to ‘update’ a row, if only certain fields (other than the unique id) of that row have changed? Or do I just delete the row and create a new one?
Share
You can send a PUT or MERGE request to the entity in question (just like you would send a DELETE) to update the entity. PUT has a “replace” semantics (so properties not sent from the client will get reset to their default values), MERGE has a “merge” semantics (so properties not sent from the client are left untouched). From you description you seem to want to use MERGE.
See this for a sample: http://www.odata.org/developers/protocols/operations#UpdatingEntries