Hi, I have a request to obtain some more info from the Supervisor HTTP API:
# Interacting with the Resin Supervisor
The Resin Supervisor is resin.io's agent that runs on devices. Its main role is to ensure your app is running, and keep communications with the Resin API server.
The Supervisor itself has its own API, with means for user applications to communicate and execute some special actions that affect the host OS or the application itself. There are two main ways for the application to interact with the Supervisor: the update lockfile and the HTTP API.
Only Supervisors after version 1.1.0 have this functionality, and some of the endpoints appeared in later versions (we've noted it down where this is the case). Supervisor version 1.1.0 corresponds to OS images downloaded after October 14th 2015.
## HTTP API reference
The supervisor exposes an HTTP API on port 48484 (`RESIN_SUPERVISOR_PORT`).
**All endpoints require an apikey parameter, which is exposed to the application as `RESIN_SUPERVISOR_API_KEY`.**
The full address for the API, i.e. `"http://127.0.0.1:48484"`, is available as `RESIN_SUPERVISOR_ADDRESS`. **Always use these variables when communicating via the API, since address and port could change**.
Alternatively, the Resin API (api.resin.io) has a proxy endpoint at `POST /supervisor/<url>` (where `<url>` is one of the API URLs described below) from which you can send API commands to the supervisor remotely, using your Auth Token instead of your API key. Commands sent through the proxy require an `appId` and/or `deviceId` parameter in the body, and default to POST requests unless you specify a `method` parameter (e.g. "GET").
The API is versioned (currently at v1), except for `/ping`.
This file has been truncated. show original
I’d like to obtain the current IP address of a specific Device within an application
It would also be great to receive the last 10 or so log lines from a specific Device within an application
Would any of this be possible through the API?
Robin
Eugene
February 9, 2016, 11:33am
2
Hi. I think you don’t even need the supervisor (on-device) API for that — the Resin (cloud) API can be used instead.
Have you looked into our CLI and / or SDKs?
Eugene
February 9, 2016, 11:35am
3
Perfect, thanks Eugene. I use NodeJS so the SDK works perfectly. I didn’t know it existed, so thanks for that.
Eugene
February 10, 2016, 9:19am
5
You’re welcome. Should you have any issues please report them to the corresponding repos.