AnsweredAssumed Answered

Get / Put Strategy When Programming With REST API

Question asked by Jeff Whitney on Feb 21, 2019
Latest reply on Feb 25, 2019 by Forest Basford

I'm creating a custom VB.NET application that accesses our instance using the REST API. I'm wondering if anyone can recommend a general strategy for preventing records from being edited in the time between the custom app GET and PUT calls are made?


I read an article that seems to address this issue called "Optimistic Locking in a REST API", where they perform a Conditional PUT using the HTTP Header / ETag / If-Match..."By specifying the appropriate ETag and condition header, you can perform optimistic locking for concurrent operations on a resource....using the If-Match header during the PUT call. If the ETag header does not match the value of the resource on the server, the server rejects the change with a 412 Precondition Failed error. The client is therefore notified of the error, and can try the request again after updating their local copy of the resource."


Is this possible with how SugarCRM has implemented their REST API?

Is this a typical strategy to check the state of a record prior to a PUT call?

Anyone using RestSharp in Visual Studio and has a solution for this issue?

Anyone else doing something different to check for altered records prior to PUT calls?


Any feedback would be much appreciated.