mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-05-01 00:37:15 +00:00

* Fix supervisor ping URL In the current version I had to ping `http://<host>/supervisor/ping`, instead of `http://<host>/ping` as implied by the docs. ``` $ curl -sSL -H 'Authorization: Bearer <TOKEN>' 'http://homeassistant.local/ping' 404: Not Found $ curl -sSL -H 'Authorization: Bearer <TOKEN>' 'http://homeassistant.local/supervisor/ping' {"result": "ok", "data": {}} ``` * Use 'supervisor' as host name Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
48 lines
719 B
Markdown
48 lines
719 B
Markdown
---
|
|
title: "Examples"
|
|
---
|
|
|
|
Examples on how to interface against the supervisor API.
|
|
|
|
## Get network information with cURL
|
|
|
|
```bash
|
|
curl -sSL -H "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/network/info
|
|
```
|
|
|
|
**response:**
|
|
|
|
```json
|
|
{
|
|
"result": "ok",
|
|
"data": {
|
|
"interfaces": {
|
|
"eth0": {
|
|
"ip_address": "192.168.1.100/24",
|
|
"gateway": "192.168.1.1",
|
|
"id": "Wired connection 1",
|
|
"type": "802-3-ethernet",
|
|
"nameservers": ["192.168.1.1"],
|
|
"method": "static",
|
|
"primary": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## Ping the supervisor
|
|
|
|
```bash
|
|
curl -sSL http://supervisor/supervisor/ping
|
|
```
|
|
|
|
**response:**
|
|
|
|
```json
|
|
{
|
|
"result": "ok",
|
|
"data": {}
|
|
}
|
|
```
|