ConcourseSuite Support

Support
Corporate
PUBLIC PROFILE

I am sending an UPDATE request and I receive a "conflict" in the response?

When you call an "UPDATE" method, the corresponding update method in the object specified is called to execute an UPDATE SQL statement. The sql uses the 'modified' sent in the xml and compares it with the 'modified' that currently exists in the database for this object. The reason for this comparison is to avoid 2 users simultaneously updating the record and also to avoid someone overwriting the record with stale data.

Let me try to provide an example for the stale data. Say you and I use the XML api to query the same "Task" object today. Now on both of our individual remote systems the task object exists as it was today. Say tomorrow I send an UPDATE request XML packet for this task. If it was updated successfully then the version of the task on the server and on my system match. Your system would have a stale version of the task. Now if you try to update the task without looking at the latest values available for this task at the server, then the server should reject your task UPDATE packet.

It would be the responsibility of the client using the API to keep track of the 'modified' timestamp against the object that was fetched from the server. Whenever the client tries to update the object, it should send the 'modified' value that it has. If the object at the server has already been updated by someone else then the 'modified' will no longer match and server will report a conflict, in which case the client should first query the object for the latest values (including modified timestamp of the object at the server) and send the update back which would then work.

So in your packet please include the <modified>[timestamp that you had fetched using a select in the past for this object]</modified>

Sign in to add your comment.