list device env varibales using the API

It is really tricky to get the correct request for the API
im trying to list de env variables for a device

curl -X GET -k --cacert ca.crt -H “Content-Type: application/json” -H “Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxx” “https://api.xxxxxx.com/v5/device_environment_variable?$filter=device%20eq%202951771da877262950ae1d398cc620g3

im getting the following error:
“Malformed url: ‘/resin/device_environment_variable?\$filter=device%20eq%202951771da877262950ae1d398cc620g3’”

i would appreciate any help thanks

Hi,

Our backend exposes an OData API for accessing its resources.
As far as I can see from your query it’s probably just missing the url encoded quotes and has an extra \ before the $filter.
Here is the curl that I would suggest you for this use case:

curl 'https://api.balena-cloud.com/v5/device_environment_variable?$filter=device/any(d:d/uuid%20eq%20%27your_uuid%27)' \
  -H 'authorization: Bearer ****'

In case that you are doing this requests on an environment that node or python is available, I would suggest you to give a try to our respective SDKs.
Let me point you to those:


Let us know if you need any further assistance.

Kind regards,
Thodoris

1 Like