Can I return the object id from a REST API?

Hi, all. I just create a REST API from one on my entities, and let it be ‘Client’. I  want to expose the put method to update a client object. So do I need to list all the clients, get all the ids, and then change an object with the id, and call the put method to update the client object??  But when I debug the API, I don’t have a way to inject the id to the parameter. What is the correct way to update objects using the REST API?   TIA Andes
2 answers

If you want to uniquely identify objects then use an autonumber field and set that value as the key to find the object.





Similar to Autonumber suggestion provided by Ronald, what we did is, we added an attribute “UUID” (aka Unique ID), which is a random string generated when the object is created. Can be achieved with the help of after create events.

This UUID can be used for references and identifying objects. 

Having some sort of unique ID other than the DB id provided by mendix is always a best practice.

NOTE: There is also a way to get the Mendix ID of the object and we can assign the same ID to the UUID as well. But we need a different attribute to achieve what are you trying to do.