API returns deleted device variables

The Device Variables API seems to return the deleted vars as well. Is there a way to skip those, or have a timestamp indicating when they were deleted?

Hello @vlad4800,

I can confirm the issue. If you delete the variables using the API this doesn’t happen. I am checking with the front-end team and I will get back at you asap.


Hey @vlad4800, actually after double checking on my end, it looks like the API is actually correct.

Could you let me know how you are talking with the API?

Can you try running this on the terminal:

curl -X GET "https://api.balena-cloud.com/v4/device_environment_variable?\$filter=device%20eq%20<DEVICE-ID>" -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" | jq 

One issue that can happen is in the /$filter, depending how you are submitting the GET request, it could be getting the variable from all devices.

I found the issue. I was using the device UUID instead of the actual device ID.

This is often very confusing and it doesn’t make sense to have 2 ID’s, I’m sure I’m not the only one making this confusion. For some resources, like tags, you use the UUId, for others you use the ID.

What is the difference between these 2 IDs?

@vlad4800 Glad you got to the bottom of it. The IDs are indeed a source of confusion. We are actively working on removing them from all API calls and SDK usage, both for this reason and for the simple fact that IDs that aren’t unique will not work when devices move between balena backends for instance when moving between openbalena and balenaCloud. Unfortunately this is a deep change and will take a long time until we have them fully disappear from sight :confused: