Web services REST

I tried to use axelor’s REST API but when I tried to do an update, nothing is updated, for example:
I want to update Vehicle line :
1 – I am calling : http://localhost:8080/axelor-erp/ws/rest/com.axelor.apps.fleet.db.Vehicle/32
2 – I set the field I want to change in JSON like :
{ "data": { "color": "test" } }
I don’t receive any error, but, Axelor returns the dictionnary with 0 update (the same dictionnary); I tried to set the whole dictionnary, (with all field) it works once, but when I try to change anything after this, axelor returns :

The record has been updated or deleted by another transaction: [Vehicle {id: 32}]

Any help, I tried to search in forum but I found nothing.


May be you missed “id” in data.
Check rest api doc for more details https://docs.axelor.com/adk/5.0/dev-guide/web-services/rest.html

I tried with id too, but it’s the same :confused:

In addition to the field id, you need to send the version field. version field is available for all objects and used to check that the row has not been updated since the last time it was retrieved when updating the persistent object.
That’s why you have the The record has been updated or deleted by another transaction: [Vehicle {id: 32}] message when you update the record for the second time : version is now oldValue + 1.
Through web services, when you update a record, the response contains the updated values. You should see the version with the new value.

Hope this will help.

1 « J'aime »

Thank you, it was the problem, it’s would be better to set this on documentation, Regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.