The docs provide an example via the BalenaCloud or via an Application container but is it also possible via a direct connection on the same LAN? What API key should I use?
If not, how should I connect when I do not have an internet connection?
Yes this should be possible by running a separate container (with the appropriate label to allow it to access the Supervisor API), and then using this container to proxy requests to the supervisor. However, could you explain your use case here? It’s quite an unusual thing to do, and there may be a more standard approach to achieve what you’re trying to do.
Thanks for your reply. Maybe my question was not really clear. I know it it possible via a running container but I would like to do it via a remote device, e.g. a laptop.
We have a user application that shows the devices present in the LAN (using a custom mDNS service). This user application is equipped with an action to reboot devices. Currently we are using a separate HTTP server for this on the device (we are currently running without Balena and we are looking to move our platform to BalenaOS). Now I saw that this reboot for example is also possible via the Balena Supervisor API: https://www.balena.io/docs/reference/supervisor/supervisor-api/#post-v1reboot . Is it possible to call this API using my user application that is running on a user laptop? We don’t want to use the cloud api since we often do not have an internet connection.
There is currently no way to interact directly with the Supervisor API outside of a service container on a device. We are not planning on exposing this functionality, as this would affect several balena features, including security.
However, as Scott mentioned, the closest you can get to this at the moment is to add the functionality to a service container to allow the use of the local Supervisor API, and then to proxy this use via exposing a port externally from this service container on a known port which an external device (like a laptop) on the same network could then connect to. This would then allow you to use the Supervisor API, via the proxy in the device’s service container, to reboot the device.