Interesting question - uuid vs id

Hey API team,

just spent some time trying to figure out an ODATA expression and found that it wasn’t working because the environment variable API wanted the devices’ ID rather than uuid.

Found that I needed the ID as opposed to the uuid of the device.
Any reason why the UUID wasn’t used in place of ID to keep things consistent?

Hi, could you please provide an example of the expression you’re using?

Hi Lucianbuzzo I worked it out now thanks.
Literally just using the wrong id value, I was just curious on the design decision.

Hi,
Using UUID has a number of benefits, one of them being that API consumers don’t use database specific numbers.
It should be fine to do an extra request to find the device ID and use it for other requests, but for sure your shouldn’t rely on that ID for longer periods of time.
Using UUIDs also has benefits in use cases like pre-provisioning devices and moving devices between different balena/open-balena instances. In such cases UUIDs can be the point of reference for devices.

Please give us a note if you need help with an OData query.

Kind regards,
Thodoris