diff --git a/docs/api/rest.md b/docs/api/rest.md index 5a2ff55c..9452f04e 100644 --- a/docs/api/rest.md +++ b/docs/api/rest.md @@ -1,6 +1,7 @@ --- title: "REST API" --- +import ApiEndpoint from '@site/static/js/api_endpoint.jsx' Home Assistant provides a RESTful API on the same port as the web frontend. (default port is port 8123). @@ -59,8 +60,8 @@ Successful calls will return status code 200 or 201. Other status codes that can ### Actions The API supports the following actions: -
-/api/ + + Returns a message if the API is up and running. @@ -77,10 +78,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" http://localhost:8123/api/ ``` -
+ -
-/api/config + Returns the current configuration as JSON. @@ -132,10 +132,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" http://localhost:8123/api/config ``` -
+ -
-/api/discovery_info + Returns basic information about the Home Assistant instance as JSON. @@ -151,14 +150,13 @@ Returns basic information about the Home Assistant instance as JSON. Sample `curl` command: ```shell -curl -X GET -H "Authorization: Bearer ABCDEFGH" \ - -H "Content-Type: application/json" http://localhost:8123/api/discovery_info +curl -X GET -H "Content-Type: application/json" \ + http://localhost:8123/api/discovery_info ``` -
+ -
-/api/events + Returns an array of event objects. Each event object contains event name and listener count. @@ -182,10 +180,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" http://localhost:8123/api/events ``` -
+ -
-/api/services + Returns an array of service objects. Each object contains the domain and which services it contains. @@ -214,10 +211,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" http://localhost:8123/api/services ``` -
+ -
-/api/history/period/<timestamp> + Returns an array of state changes in the past. Each object contains further details for the entities. @@ -231,6 +227,7 @@ You can pass the following optional GET parameters: - `significant_changes_only` to only return significant state changes. Example without `minimal_response` + ```json [ [ @@ -259,6 +256,7 @@ Example without `minimal_response` ``` Example with `minimal_response` + ```json [ [ @@ -279,7 +277,7 @@ Example with `minimal_response` { "last_changed": "2016-02-06T22:22:00+00:00", "state": "-2.2" - }, + }, { "attributes": { "friendly_name": "Weather Temperature", @@ -302,7 +300,6 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00 ``` - ```shell curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" \ @@ -321,10 +318,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?end_time=2016-12-31T00%3A00%3A00%2B02%3A00 ``` -
+ -
-/api/logbook/<timestamp> + Returns an array of logbook entries. @@ -385,10 +381,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/logbook/2016-12-29T00:00:00+02:00?end_time=2099-12-31T00%3A00%3A00%2B02%3A00 ``` -
+ -
-/api/states + Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes. @@ -416,10 +411,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ -H "Content-Type: application/json" http://localhost:8123/api/states ``` -
+ -
-/api/states/<entity_id> + Returns a state object for specified entity_id. Returns 404 if not found. @@ -447,10 +441,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/states/sensor.kitchen_temperature ``` -
+ -
-/api/error_log + Retrieve all errors logged during the current session of Home Assistant as a plaintext response. @@ -468,10 +461,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/error_log ``` -
+ -
-/api/camera_proxy/<camera entity_id> + Returns the data (image) from the specified camera entity_id. @@ -483,10 +475,9 @@ curl -X GET -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/camera_proxy/camera.my_sample_camera?time=1462653861261 -o image.jpg ``` -
+ -
-/api/states/<entity_id> + Updates or creates a state. You can create any state that you want, it does not have to be backed by an entity in Home Assistant. @@ -530,10 +521,9 @@ curl -X POST -H "Authorization: Bearer ABCDEFGH" \ http://localhost:8123/api/states/sensor.kitchen_temperature ``` -
+ -
-/api/events/<event_type> + Fires an event with event_type. Please be mindful of the data structure as documented on our [Data Science portal](https://data.home-assistant.io/docs/events/#database-table). @@ -553,10 +543,9 @@ Returns a message if successful. } ``` -
+ -
-/api/services/<domain>/<service> + Calls a service within a specific domain. Will return when the service has been executed or after 10 seconds, whichever comes first. @@ -612,10 +601,9 @@ curl -X POST \ The result will include any states that changed while the service was being executed, even if their change was the result of something else happening in the system. ::: -
+ -
-/api/template + Render a Home Assistant template. [See template docs for more information.](https://www.home-assistant.io/topics/templating/) @@ -639,10 +627,9 @@ curl -X POST -H "Authorization: Bearer ABCDEFGH" \ -d '{"template": "It is {{ now() }}!"}' http://localhost:8123/api/template ``` -
+ -
-/api/config/core/check_config + Trigger a check of `configuration.yaml`. No additional data needs to be passed in with this request. Needs config integration enabled. @@ -664,4 +651,4 @@ If the check fails, the errors attribute in the object will list what caused the } ``` -
+ diff --git a/docs/api/supervisor/endpoints.md b/docs/api/supervisor/endpoints.md index 4bd6db6a..62624a8f 100644 --- a/docs/api/supervisor/endpoints.md +++ b/docs/api/supervisor/endpoints.md @@ -1,6 +1,7 @@ --- title: "Endpoints" --- +import ApiEndpoint from '@site/static/js/api_endpoint.jsx' For API endpoints marked with :lock: you need use an authorization header with a `Bearer` token. @@ -11,9 +12,7 @@ To see more details about each endpoint, click on it to expand it. ### Addons -
-/addons - + Return overview information about add-ons and add-on repositories. **Payload:** @@ -57,46 +56,29 @@ Return overview information about add-ons and add-on repositories. } ``` -
- -
-/addons/reload + + Reloads the information stored about add-ons. + -
- -
-/addons/[addon]/changelog - + Get the changelog for a add.on. + -
- -
-/addons/[addon]/documentation - + Get the documentation for a add.on. + -
- -
-/addons/[addon]/logs - + Returns the raw container logs from docker. + -
- -
-/addons/[addon]/icon - + Get the add-on icon + -
- -
-/addons/[addon]/info - + Get details about a add-on **Returned data:** @@ -243,25 +225,17 @@ Get details about a add-on } ``` -
- -
-/addons/[addon]/install + + Install a add-on + -
- -
-/addons/[addon]/logo - + Get the add-on logo + -
- -
-/addons/[addon]/options - + Set the protection mode on a add-on. This function is not callable by itself and you can not use `self` as the slug here. @@ -301,32 +275,21 @@ To reset customized network/audio/options, set it `null`. } ``` -
- -
-/addons/[addon]/options/validate + + Run a configuration validation against the current stored add-on configuration. + -
- -
-/addons/[addon]/rebuild - + Rebuild the add-on, only supported for local build add-ons. + -
- -
-/addons/[addon]/restart - + Restart a add-on + -
- -
-/addons/[addon]/security - + Set the protection mode on a add-on. This function is not callable by itself and you can not use `self` as the slug here. @@ -337,17 +300,13 @@ This function is not callable by itself and you can not use `self` as the slug h | --------- | ------- | ------------------------------- | | protected | boolean | `true` if protection mode is on | -
- -
-/addons/[addon]/start + + Start a add-on + -
- -
-/addons/[addon]/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the add-on. @@ -366,43 +325,29 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the add-on. } ``` -
- -
-/addons/[addon]/stdin + + Write data to add-on stdin. The payload you want to pass into the addon you give the endpoint as the body of the request. + -
- -
-/addons/[addon]/stop - + Stop a add-on + -
- -
-/addons/[addon]/uninstall - + Uninstall a add-on + -
- -
-/addons/[addon]/update - + Update a add-on - -
+ ### Audio -
-/audio/default/input - + Set a profile as the default input profile **Payload:** @@ -411,11 +356,9 @@ Set a profile as the default input profile | ---- | ------ | -------- | ----------------------- | | name | string | False | The name of the profile | -
- -
-/audio/default/output + + Set a profile as the default output profile **Payload:** @@ -424,11 +367,9 @@ Set a profile as the default output profile | ---- | ------ | -------- | ----------------------- | | name | string | False | The name of the profile | -
- -
-/audio/info + + Return information about the audio plugin. **Returned data:** @@ -521,18 +462,13 @@ Return information about the audio plugin. } ``` -
- -
-/audio/logs + + Returns the raw container logs from docker. + -
- -
-/audio/mute/input - + Mute input devices **Payload:** @@ -542,11 +478,9 @@ Mute input devices | index | string | False | The index of the device | | active | boolean | False | `true` if muted | -
- -
-/audio/mute/input/[application] + + Mute input for a specific application **Payload:** @@ -556,11 +490,9 @@ Mute input for a specific application | index | string | False | The index of the device | | active | boolean | False | `true` if muted | -
- -
-/audio/mute/output + + Mute output devices **Payload:** @@ -570,11 +502,9 @@ Mute output devices | index | string | False | The index of the device | | active | boolean | False | `true` if muted | -
- -
-/audio/mute/output/[application] + + Mute output for a specific application **Payload:** @@ -584,11 +514,9 @@ Mute output for a specific application | index | string | False | The index of the device | | active | boolean | False | `true` if muted | -
- -
-/audio/profile + + Create a audio profile **Payload:** @@ -598,24 +526,17 @@ Create a audio profile | card | string | False | The name of the audio device | | name | string | False | The name of the profile | -
- -
-/audio/reload + + Reload audio information + -
- -
-/audio/restart - + Restart the audio plugin + -
- -
-/audio/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the audio plugin. @@ -634,11 +555,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the audio plugin. } ``` -
- -
-/audio/update + + Update the audio plugin **Payload:** @@ -647,11 +566,9 @@ Update the audio plugin | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
- -
-/audio/volume/input + + Set the input volume **Payload:** @@ -661,11 +578,9 @@ Set the input volume | index | string | False | The index of the device | | volume | float | False | The volume (between `0.0`and `1.0`) | -
- -
-/audio/volume/input/[application] + + Set the input volume for a specific application **Payload:** @@ -675,11 +590,9 @@ Set the input volume for a specific application | index | string | False | The index of the device | | volume | float | False | The volume (between `0.0`and `1.0`) | -
- -
-/audio/volume/output + + Set the output volume **Payload:** @@ -689,11 +602,9 @@ Set the output volume | index | string | False | The index of the device | | volume | float | False | The volume (between `0.0`and `1.0`) | -
- -
-/audio/volume/output/[application] + + Set the output volume for a specific application **Payload:** @@ -703,13 +614,11 @@ Set the output volume for a specific application | index | string | False | The index of the device | | volume | float | False | The volume (between `0.0`and `1.0`) | -
+ ### Auth -
-/auth - + You can do authentication against Home Assistant Core. You can POST the data as JSON, as urlencoded (with `application/x-www-form-urlencoded` header) or by using use basic authentication. @@ -720,11 +629,9 @@ You can POST the data as JSON, as urlencoded (with `application/x-www-form-urlen | username | string | The username for the user | | password | string | The password for the user | -
- -
-/auth/reset + + Set a new password for a Home Assistant Core user. **Payload:** @@ -734,21 +641,18 @@ Set a new password for a Home Assistant Core user. | username | string | The username for the user | | password | string | The new password for the user | -
+ -
-/auth/cache + Reset internal authentication cache, this is useful if you have changed the password for a user and need to clear the internal cache. -
+ ### CLI -
-/cli/info - + Returns information about the CLI plugin **Returned data:** @@ -767,10 +671,9 @@ Returns information about the CLI plugin } ``` -
+ -
-/cli/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the CLI plugin. @@ -789,11 +692,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the CLI plugin. } ``` -
- -
-/cli/update + + Update the CLI plugin **Payload:** @@ -802,34 +703,23 @@ Update the CLI plugin | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### Core -
-/core/api - + Proxy GET API calls to the Home Assistant API + -
- -
-/core/api - + Proxy POST API calls to the Home Assistant API + -
- -
-/core/check - + Run a configuration check + -
- -
-/core/info - + Returns information about the Home Assistant core **Returned data:** @@ -870,18 +760,13 @@ Returns information about the Home Assistant core } ``` -
- -
-/core/logs + + Returns the raw container logs from docker. + -
- -
-/core/options - + Update options for Home Assistant, you need to supply at least one of the payload keys to the API call. You need to call `/core/restart` after updating the options. @@ -903,31 +788,21 @@ Passing `image` with `null` and `version_latest` with `null` resets these option **You need to supply at least one key in the payload.** -
- -
-/core/rebuild + + Rebuild the Home Assistant core container + -
- -
-/core/restart - + Restart the Home Assistant core container + -
- -
-/core/start - + Start the Home Assistant core container + -
- -
-/core/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the Home Assistant core. @@ -946,18 +821,13 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the Home Assistant c } ``` -
- -
-/core/stop + + Stop the Home Assistant core container + -
- -
-/core/update - + Update Home Assistant core **Payload:** @@ -966,20 +836,15 @@ Update Home Assistant core | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
- -
-/core/websocket + + Proxy to Home Assistant Core websocket. - -
+ ### Discovery -
-/discovery - + Return information about enabled discoveries. **Returned data:** @@ -1007,11 +872,9 @@ Return information about enabled discoveries. } ``` -
- -
-/discovery + + Create a discovery service **Payload:** @@ -1029,27 +892,21 @@ Create a discovery service } ``` -
+ -
-/discovery/[uuid] + Get a [discovery model](api/supervisor/models.md#discovery) for a UUID. -
- -
-/discovery/[uuid] + + Delete a specific service. - -
+ ### DNS -
-/dns/info - + Return information about the DNS plugin. **Returned data:** @@ -1074,18 +931,13 @@ Return information about the DNS plugin. } ``` -
- -
-/dns/logs + + Returns the raw container logs from docker. + -
- -
-/dns/options - + Set DNS options **Payload:** @@ -1096,24 +948,17 @@ Set DNS options **You need to supply at least one key in the payload.** -
- -
-/dns/reset + + Reset the DNS configuration. + -
- -
-/dns/restart - + Restart the DNS plugin + -
- -
-/dns/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the dns plugin. @@ -1132,11 +977,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the dns plugin. } ``` -
- -
-/dns/update + + Update the DNS plugin **Payload:** @@ -1145,13 +988,11 @@ Update the DNS plugin | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### Docker -
-/docker/info - + Returns information about the docker instance. **Returned data:** @@ -1174,11 +1015,9 @@ registries | dictionary | A dictionary of dictionaries containing `username` and } ``` -
- -
-/docker/registries + + Get all configured container registries, this returns a dict with the registry hostname as the key, and a dictionary containing the username configured for that registry. **Example response:** @@ -1191,11 +1030,9 @@ Get all configured container registries, this returns a dict with the registry h } ``` -
- -
-/docker/registries + + Add a new container registry. **Payload:** @@ -1215,20 +1052,15 @@ Add a new container registry. } ``` -
- -
-/docker/registries/[registry] + + Delete a registry from the configured container registries. - -
+ ### Hardware -
-/hardware/info - + Get hardware information. **Example response:** @@ -1252,11 +1084,9 @@ Get hardware information. } ``` -
- -
-/hardware/audio + + Get audio devices **Example response:** @@ -1275,20 +1105,15 @@ Get audio devices } ``` -
- -
-/hardware/trigger + + Trigger UDEV reload. - -
+ ### Host -
-/host/info - + Return information about the host. **Returned data** @@ -1323,18 +1148,13 @@ Return information about the host. } ``` -
- -
-/host/logs + + Get the dmesg logs from the host. + -
- -
-/host/options - + Set host options **Payload:** @@ -1345,46 +1165,29 @@ Set host options **You need to supply at least one key in the payload.** -
- -
-/host/reboot + + Reboot the host + -
- -
-/host/reload - + Reload host information + -
- -
-/host/service/[service]/start - + Start a service on the host. + -
- -
-/host/service/[service]/stop - + Stop a service on the host. + -
- -
-/host/service/[service]/reload - + Reload a service on the host. + -
- -
-/host/services - + Get information about host services. **Returned data:** @@ -1407,19 +1210,15 @@ Get information about host services. } ``` -
- -
-/host/shutdown + + Shutdown the host - -
+ ### ingress -
-/ingress/panels + **Returned data:** @@ -1442,11 +1241,9 @@ Shutdown the host } ``` -
- -
-/ingress/session + + Create a new session for access to the ingress service. **Payload:** @@ -1455,13 +1252,11 @@ Create a new session for access to the ingress service. | ------- | ------ | -------- | --------------------------------- | | session | string | False | The token for the ingress session | -
+ ### Misc -
-/info - + Returns a dict with selected keys from other `/*/info` endpoints. **Returned data:** @@ -1504,13 +1299,11 @@ Returns a dict with selected keys from other `/*/info` endpoints. } ``` -
+ ### Multicast -
-/multicast/info - + Returns information about the multicast plugin **Returned data:** @@ -1529,24 +1322,17 @@ Returns information about the multicast plugin } ``` -
- -
-/multicast/logs + + Returns the raw container logs from docker. + -
- -
-/multicast/restart - + Restart the multicast plugin. + -
- -
-/multicast/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the multicast plugin. @@ -1565,11 +1351,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the multicast plugin } ``` -
- -
-/multicast/update + + Update the multicast plugin **Payload:** @@ -1578,13 +1362,11 @@ Update the multicast plugin | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### Network -
-/network/info - + Get network information. **Returned data:** @@ -1619,17 +1401,15 @@ Get network information. } ``` -
+ -
-/network/[interface]/info + Returns a [Network interface model](api/supervisor/models.md#network-interface) for a specific network interface. -
+ -
-/network/[interface]/update + Update the settings for a network interface. @@ -1664,12 +1444,11 @@ When the call is complete it returns the changed [Network interface model](api/s } ``` -
+ ### Observer -
-/observer/info + Returns information about the observer plugin @@ -1691,10 +1470,9 @@ Returns information about the observer plugin } ``` -
+ -
-/observer/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the observer plugin. @@ -1713,10 +1491,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the observer plugin. } ``` -
+ -
-/observer/update + Update the observer plugin @@ -1726,19 +1503,17 @@ Update the observer plugin | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### OS -
-/os/config/sync + Load host configurations from an USB stick. -
+ -
-/os/info + Returns information about the OS. @@ -1762,10 +1537,9 @@ Returns information about the OS. } ``` -
+ -
-/os/update + Update Home Assistant OS @@ -1775,12 +1549,11 @@ Update Home Assistant OS | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### Resolution -
-/resolution/info + **Returned data:** @@ -1814,33 +1587,29 @@ Update Home Assistant OS } ``` -
+ -
-/resolution/suggestion/[uuid] + Apply a suggested action -
+ -
-/resolution/suggestion/[uuid] + Dismiss a suggested action -
+ -
-/resolution/issue/[uuid] + Dismiss a issue -
+ ### Service -
-/services + **Returned data:** @@ -1862,10 +1631,9 @@ Dismiss a issue } ``` -
+ -
-/services/mqtt + **Returned data:** @@ -1893,10 +1661,9 @@ Dismiss a issue } ``` -
+ -
-/services/mqtt + Create a service definition @@ -1911,17 +1678,15 @@ Create a service definition | password | string | The password for the service | | protocol | string | The MQTT protocol | -
+ -
-/services/mqtt + Deletes the service definitions -
+ -
-/services/mysql + **Returned data:** @@ -1947,10 +1712,9 @@ Deletes the service definitions } ``` -
+ -
-/services/mysql + Create a service definition @@ -1963,19 +1727,17 @@ Create a service definition | username | string | The username for the service | | password | string | The password for the service | -
+ -
-/services/mysql + Deletes the service definitions -
+ ### Snapshot -
-/snapshots + Return a list of [Snapshot models](api/supervisor/models.md#snapshot) @@ -1995,10 +1757,9 @@ Return a list of [Snapshot models](api/supervisor/models.md#snapshot) } ``` -
+ -
-/snapshots/new/full + Create a full snapshot. @@ -2017,10 +1778,9 @@ Create a full snapshot. } ``` -
+ -
-/snapshots/new/upload + Upload a snapshot. @@ -2032,10 +1792,9 @@ Upload a snapshot. } ``` -
+ -
-/snapshots/new/partial + Create a partial snapshot. @@ -2058,38 +1817,33 @@ Create a partial snapshot. } ``` -
+ -
-/snapshots/reload + Reload snapshots from storage. -
+ -
-/snapshots/[snapshot]/download + Download the snapshot file with the given slug. -
+ -
-/snapshots/[snapshot]/info + Returns a [Snapshot details model](api/supervisor/models.md#snapshot-details) for the add-on. -
+ -
-/snapshots/[snapshot] + Removes the snapshot file with the given slug. -
+ -
-/snapshots/[snapshot]/restore/full + Does a full restore of the snapshot with the given slug. @@ -2099,10 +1853,9 @@ Does a full restore of the snapshot with the given slug. | -------- | ------ | -------- | ------------------------------------ | | password | string | True | The password for the snapshot if any | -
+ -
-/snapshots/[snapshot]/restore/partial + Does a partial restore of the snapshot with the given slug. @@ -2117,12 +1870,11 @@ Does a partial restore of the snapshot with the given slug. **You need to supply at least one key in the payload.** -
+ ### Supervisor -
-/supervisor/info + Returns information about the supervisor @@ -2180,17 +1932,15 @@ Returns information about the supervisor } ``` -
+ -
-/supervisor/logs + Returns the raw container logs from docker. -
+ -
-/supervisor/options + Update options for the supervisor, you need to supply at least one of the payload keys to the API call. You need to call `/supervisor/reload` after updating the options. @@ -2207,31 +1957,27 @@ You need to call `/supervisor/reload` after updating the options. | logging | string | Set logging level | | addons_repositories | list | Set a list of URL's as strings for add-on repositories | -
+ -
-/supervisor/ping + Ping the supervisor to check if it can return a response. -
+ -
-/supervisor/reload + Reload parts of the supervisor, this enable new options, and check for updates. -
+ -
-/supervisor/repair + Repair docker overlay issues, and lost images. -
+ -
-/supervisor/stats + Returns a [Stats model](api/supervisor/models.md#stats) for the supervisor. @@ -2250,10 +1996,9 @@ Returns a [Stats model](api/supervisor/models.md#stats) for the supervisor. } ``` -
+ -
-/supervisor/update + Update the supervisor @@ -2263,11 +2008,11 @@ Update the supervisor | ------- | ------ | -------------------------------------------------------------- | | version | string | The version you want to install, default is the latest version | -
+ ### Placeholders -Some of the endpoints uses placeholders indicated with `[]` in the endpoint URL. +Some of the endpoints uses placeholders indicated with `<...>` in the endpoint URL. | placeholder | description | | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/css/custom.css b/src/css/custom.css index 347c5c9b..46a549b2 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -97,52 +97,54 @@ html[data-theme='dark'] .invertDark { filter: invert(1.0) } -/* Custom summary styles for API endpoint definitions */ -summary.endpoint { +/* Styles for @site/static/js/api_endpoint.jsx */ +.api-endpoint { + margin: 4px 0; +} +.api-endpoint-header { align-items: center; background-color: var(--ifm-code-background); - word-break: break-all; border-radius: var(--ifm-code-border-radius); - color: var(--ifm-code-color); cursor: pointer; display: flex; - font-family: var(--ifm-font-family-monospace); - margin: 4px 0; padding: var(--ifm-code-padding-vertical) var(--ifm-code-padding-horizontal); + word-break: break-all; } -summary.endpoint::-webkit-details-marker { - display: none; +.api-endpoint-content { + padding: 8px 8px 16px; } -summary.endpoint:before { - border-radius: 8px; + +.api-endpoint-protection { + margin: auto; + margin-right: 0; +} + +.api-endpoint-method { + border-radius: 4px; color: white; display: block; font-weight: bold; margin-right: 12px; + min-width: 84px; padding: 4px; text-align: center; - width: 75px; + text-transform: uppercase; + width: 84px; } -summary.endpoint.post:before { - content: "POST"; - background-color: var(--ifm-color-success); + +.api-endpoint-method.delete { + background-color: #f93e3e; } -summary.endpoint.get:before { - content: "GET"; - background-color: var(--ifm-color-info); + +.api-endpoint-method.get { + background-color: #61affe; } -summary.endpoint.delete:before { - content: "DELETE"; - background-color: var(--ifm-color-danger) + +.api-endpoint-method.post { + background-color: #49cc90; } -summary.endpoint.protected:after { - content: "🔒"; - margin: auto; - margin-right: 0; + +.api-endpoint-method.put { + background-color: #fca130; } -summary.endpoint.unprotected:after { - content: "🔓"; - margin: auto; - margin-right: 0; -} -/* Custom summary styles for API endpoint definitions */ \ No newline at end of file +/* Styles for @site/static/js/api_endpoint.jsx */ \ No newline at end of file diff --git a/static/js/api_endpoint.jsx b/static/js/api_endpoint.jsx new file mode 100644 index 00000000..2014a04b --- /dev/null +++ b/static/js/api_endpoint.jsx @@ -0,0 +1,47 @@ +import React from 'react'; + +// Styles for this element is defined in src/css/custom.css + +export default class ApiEndpoint extends React.Component { + constructor(props){ + super(props); + this.state = { + open: false + } + this.toggleInfo = this.toggleInfo.bind(this); + } + + toggleInfo(e){ + this.setState({open: !this.state.open}) + } + + render() { + return ( +
+
+
+ {this.props.method} +
+ {this.props.path} +
+ {this.props.unprotected ? ("🔓") : ("🔒")} +
+
+ {this.state.open ? ( +
+ {this.props.children} +
+ ): null} +
+ ); + } +} \ No newline at end of file