mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-14 14:36:36 +00:00
docs: Standardise naming and json in api documentation
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
4a17f704ab
commit
d9bc26bd83
52
docs/API.md
52
docs/API.md
@ -35,7 +35,7 @@ Here's the full list of endpoints implemented so far. In all examples, replace e
|
||||
Responds with a simple "OK", signaling that the supervisor is alive and well.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X GET --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/ping?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -63,7 +63,7 @@ Starts a blink pattern on a LED for 15 seconds, if your device has one.
|
||||
Responds with an empty 200 response. It implements the "identify device" feature from the dashboard.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/blink?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -98,7 +98,7 @@ Can be a JSON object with a `force` property. If this property is true, the upda
|
||||
```
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
--data '{"force": true}' \
|
||||
@ -136,7 +136,7 @@ When successful, responds with 202 accepted and a JSON object:
|
||||
Can contain a `force` property, which if set to `true` will cause the update lock to be overridden.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/reboot?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -176,7 +176,7 @@ When successful, responds with 202 accepted and a JSON object:
|
||||
Can contain a `force` property, which if set to `true` will cause the update lock to be overridden.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/shutdown?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -223,7 +223,7 @@ Example:
|
||||
```
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
--data '{"appId": <appId>}' \
|
||||
@ -265,7 +265,7 @@ Example:
|
||||
```
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
@ -295,7 +295,7 @@ $ curl -X POST --header "Content-Type:application/json" \
|
||||
Invalidates the current `BALENA_SUPERVISOR_API_KEY` and generates a new one. Responds with the new API key, but **the application will be restarted on the next update cycle** to update the API key environment variable.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/regenerate-api-key?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -338,7 +338,7 @@ The state is a JSON object that contains some or all of the following:
|
||||
Other attributes may be added in the future, and some may be missing or null if they haven't been set yet.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X GET --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/device?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -376,7 +376,7 @@ The appId must be specified in the URL.
|
||||
Can contain a `force` property, which if set to `true` will cause the update lock to be overridden.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
@ -414,7 +414,7 @@ When successful, responds with 200 and the Id of the started container.
|
||||
The appId must be specified in the URL.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
|
||||
```bash
|
||||
$ curl -X POST --header "Content-Type:application/json" \
|
||||
@ -456,7 +456,7 @@ The appId must be specified in the URL.
|
||||
This is only supported on single-container devices, and will return 400 on devices running multiple containers.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X GET --header "Content-Type:application/json" \
|
||||
"$BALENA_SUPERVISOR_ADDRESS/v1/apps/<appId>?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
@ -489,7 +489,7 @@ Responds with an empty 200 response if the supervisor is healthy, or a 500 statu
|
||||
correctly.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl "$BALENA_SUPERVISOR_ADDRESS/v1/healthy"
|
||||
```
|
||||
@ -550,7 +550,7 @@ proxy. Keep in mind that local/reserved subnets are already [excluded by balenaO
|
||||
If either "proxy" or "hostname" are null or empty values (i.e. `{}` for proxy or an empty string for hostname), they will be cleared to their default values (i.e. not using a proxy, and a hostname equal to the first 7 characters of the device's uuid, respectively).
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl -X PATCH --header "Content-Type:application/json" \
|
||||
--data '{"network": {"hostname": "newhostname"}}' \
|
||||
@ -584,7 +584,7 @@ proxy and hostname configuration.
|
||||
Please refer to the PATCH endpoint above for details on the behavior and meaning of the fields in the response.
|
||||
|
||||
#### Examples:
|
||||
From the app on the device:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl "$BALENA_SUPERVISOR_ADDRESS/v1/device/host-config?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -611,7 +611,7 @@ Added in supervisor v7.12.0
|
||||
Get a list of applications, services and their statuses. This will reflect the
|
||||
current state of the supervisor, and not the target state.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
$ curl "$BALENA_SUPERVISOR_ADDRESS/v2/applications/state?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -671,7 +671,7 @@ Added in supervisor version v7.12.0.
|
||||
|
||||
Use this endpoint to get the state of a single application, given the appId.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/state?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -700,7 +700,7 @@ Added in supervisor version v9.7.0
|
||||
|
||||
This will return a list of images, containers, the overall download progress and the status of the state engine.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl "$BALENA_SUPERVISOR_ADDRESS/v2/state/status?apikey=$RESIN_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -747,7 +747,7 @@ For the following endpoints the application id is required in the url. The
|
||||
easiest way to get the application id from the device is to use the following
|
||||
process (note that you will need jq and curl inside your container):
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
APPNAME="supervisortest"
|
||||
APPID=$(curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/state?apikey=$BALENA_SUPERVISOR_API_KEY" | jq ".$APPNAME.appId")
|
||||
@ -766,7 +766,7 @@ Added in supervisor version v7.0.0. Support for passing `serviceName` instead of
|
||||
Use this endpoint to restart a service in the application with application id
|
||||
passed in with the url.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"serviceName": "my-service"}'
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/restart-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"imageId": 1234}'
|
||||
@ -789,7 +789,7 @@ Added in supervisor version v7.0.0. Support for passing `serviceName` instead of
|
||||
Use this endpoint to stop a service in the application with application id
|
||||
passed in with the url.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/stop-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"serviceName": "my-service"}'
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/stop-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"imageId": 1234}'
|
||||
@ -812,7 +812,7 @@ Added in supervisor version v7.0.0. Support for passing `serviceName` instead of
|
||||
Use this endpoint to start a service in the application with application id
|
||||
passed in with the url.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/start-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"serviceName": "my-service"}'
|
||||
curl --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/start-service?apikey=$BALENA_SUPERVISOR_API_KEY" -d '{"imageId": 1234}'
|
||||
@ -833,7 +833,7 @@ Added in supervisor version v7.0.0.
|
||||
|
||||
Use this endpoint to restart every service in an application.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl -X POST --header "Content-Type: application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/restart?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -853,7 +853,7 @@ Added in supervisor version v7.0.0.
|
||||
|
||||
Use this endpoint to purge all user data for a given application id.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```bash
|
||||
curl -X POST --header "Content-Type:application/json" "$BALENA_SUPERVISOR_ADDRESS/v2/applications/$APPID/purge?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -872,7 +872,7 @@ Added in supervisor v7.21.0
|
||||
|
||||
This endpoint returns the supervisor version currently running the device api.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```
|
||||
$ curl "$BALENA_SUPERVISOR_ADDRESS/v2/version?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
@ -891,7 +891,7 @@ Added in supervisor v8.6.0
|
||||
|
||||
Use this endpoint to match a service name to a container ID.
|
||||
|
||||
From the user container:
|
||||
From an application container:
|
||||
```
|
||||
$ curl "$BALENA_SUPERVISOR_ADDRESS/v2/containerId?apikey=$BALENA_SUPERVISOR_API_KEY"
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user