Files
.devcontainer
.github
.vscode
blog
docs
add-ons
api
native-app-integration
supervisor
endpoints.md
examples.md
models.md
native-app-integration.md
rest.md
websocket.md
architecture
core
documenting
frontend
internationalization
operating-system
supervisor
voice
add-ons.md
api_lib_auth.md
api_lib_data_models.md
api_lib_index.md
architecture_components.md
architecture_index.md
area_registry_index.md
asyncio_101.md
asyncio_categorizing_functions.md
asyncio_index.md
asyncio_working_with_async.md
auth_api.md
auth_auth_module.md
auth_auth_provider.md
auth_index.md
auth_permissions.md
bluetooth.md
config_entries_config_flow_handler.md
config_entries_index.md
config_entries_options_flow_handler.md
configuration_yaml_index.md
creating_component_code_review.md
creating_component_generic_discovery.md
creating_component_index.md
creating_integration_brand.md
creating_integration_file_structure.md
creating_integration_manifest.md
creating_platform_code_review.md
creating_platform_index.md
data_entry_flow_index.md
dev_101_config.md
dev_101_events.md
dev_101_hass.md
dev_101_services.md
dev_101_states.md
development_catching_up.md
development_checklist.md
development_environment.mdx
development_guidelines.md
development_index.md
development_submitting.md
development_testing.md
development_tips.md
development_typing.md
development_validation.md
device_automation_action.md
device_automation_condition.md
device_automation_index.md
device_automation_trigger.md
device_registry_index.md
documenting.md
entity_registry_disabled_by.md
entity_registry_index.md
frontend.md
instance_url.md
integration_events.md
integration_fetching_data.md
integration_listen_events.md
integration_quality_scale_index.md
integration_setup_failures.md
intent_builtin.md
intent_conversation_api.md
intent_firing.md
intent_handling.md
intent_index.md
internationalization.md
misc.md
network_discovery.md
operating-system.md
review-process.md
supervisor.md
translations.md
script
src
static
.gitignore
.npmrc
.nvmrc
LICENSE.md
README.md
docusaurus.config.js
netlify.toml
package.json
sidebars.js
yarn.lock
developers.home-assistant/docs/api/supervisor/examples.md
Chris van Marle c70f7ec86b Fix supervisor ping URL ()
* 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>
2021-06-30 09:48:17 +02:00

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": {}
}
```