release version

we have an app that controls the device, and we want to send the app the current release version of the device, sometimes (or most of the time), the device is offline.
is there a way to retrieve the current release from the device even if its offline?


Hi @mellerdaniel, you could query balena API to get the commit hash of the release that a device is running.

Here’s the relevant doc:

The field is_on__commit would show the Current Release field you see on balena dashboard. Once you have the commit hash, you could use that value to get more info about the release (and release tag if it has any) by querying a different API end point.


If i understand correctly, this wont work when the device is offline, correct?


Hey Daniel, you are welcome. It will work when the device is offline. Using balena API you are interacting with balenaCloud’s backend server. The server reports the latest information it has about the device.

Thanks for the fast response.
I’ll try to explain our use case.

My device which runs balena OS, is offline some of the time.
you can connect to it using a phone app.
there is an API to get the device information using REST between the App and the device running balena OS.

I need to have some OS query to get the release that is currently in the device, without querying the balena dashboard. (directly in the device)


Oh do you want the device itself to query the current release it is running?

The steps I explained to retrieve from balena API could be done from any machine with network connection (and the authorization token from balenaCloud).

Then from a container running in the device, you could use Supervisor API to get the commit hash of the release that it’s running:

I believe this command will keep running even if the device is offline. Let us know if it works or not.

very helpful, worked.
thank you!