From 7b58205a38f2e726211301f3727edf1ad2e071d5 Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Mon, 9 May 2016 14:50:04 -0700 Subject: [PATCH 1/2] Add /api/discovery_info REST API docs --- source/developers/rest_api.markdown | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/developers/rest_api.markdown b/source/developers/rest_api.markdown index 3f2c4107953..91a99baa770 100644 --- a/source/developers/rest_api.markdown +++ b/source/developers/rest_api.markdown @@ -99,6 +99,24 @@ Sample `curl` command: $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" http://localhost:8123/api/config ``` +#### {% linkable_title GET /api/discovery_info %} +Returns basic information about the Home Assistant instance as JSON. + +```json +{ + "base_url": "http://127.0.0.1:8123", + "location_name": "Home", + "requires_api_password": true, + "version": "0.20.0.dev0" +} +``` + +Sample `curl` command: + +```bash +$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" http://localhost:8123/api/discovery_info +``` + #### {% linkable_title GET /api/bootstrap %} Returns all data needed to bootstrap Home Assistant. From ba7eedaeb4fdff61eb3496658090dde31d803caf Mon Sep 17 00:00:00 2001 From: Robbie Trencheny Date: Mon, 9 May 2016 14:58:12 -0700 Subject: [PATCH 2/2] Add CORS documentation --- source/_components/http.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/_components/http.markdown b/source/_components/http.markdown index 3490451a05d..973ac048044 100644 --- a/source/_components/http.markdown +++ b/source/_components/http.markdown @@ -21,6 +21,9 @@ http: development: 1 ssl_certificate: /etc/letsencrypt/live/hass.example.com/fullchain.pem ssl_key: /etc/letsencrypt/live/hass.example.com/privkey.pem + cors_allowed_origins: + - google.com + - home-assistant.io ``` Configuration variables: @@ -30,6 +33,8 @@ Configuration variables: - **development** (*Optional*): Disable caching and load unvulcanized assets. Useful for Frontend development. - **ssl_certificate** (*Optional*): Path to your TLS/SSL certificate to serve Home Assistant over a secure connection. - **ssl_key** (*Optional*): Path to your TLS/SSL key to serve Home Assistant over a secure connection. +- **cors_allowed_origins** (*Optional*): A list of origin domain names to allow [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) requests from. Enabling this will set the `Access-Control-Allow-Origin` header to the Origin header if it is found in the list, and the `Access-Control-Allow-Headers` to `Origin, Accept, X-Requested-With, Content-type, X-HA-access`. + The [Set up encryption using Let's Encrypt](/blog/2015/12/13/setup-encryption-using-lets-encrypt/) blog post gives you details about the encryption of your traffic using free certificates from [Let's Encrypt](https://letsencrypt.org/).