Hey there,
Assuming you are doing this from within a container running on the device (hence the mention of the supervisor), I think the easiest way will be to use the supervisor to retrieve the releaseID, then use the releaseID to request the data from the balena API.
To retrive the releaseID: Interacting with the balena Supervisor - Balena Documentation
Release resource documentation: Resources - Balena Documentation
You’ll see that the semver
field combined with the revision
field hold the information you need.
Example request:
curl -X GET \
"https://api.balena-cloud.com/v6/release(<ID>)" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTH_TOKEN>"
Note to get a token (API key) supplied to your container, you can use the io.balena.features.balena-api
label, but I’m guessing you are already aware of this mechanism if you’ve been using the supervisor API. Read more here: docker-compose.yml fields - Balena Documentation
All that being said, if you feel that this should be easier (I would tend to agree with you if so), please submit a feature request here: https://feature-requests.balena.io/ - be sure to share your use case so we get a sense of how this information helps you. Cheers!