From dd6c65d28b45206c8777e72ce2533f61052353d8 Mon Sep 17 00:00:00 2001 From: gitmopp Date: Wed, 4 Oct 2017 07:47:54 +0200 Subject: [PATCH] Enhanced documentation of api/history (#3508) Added missing end_time information --- source/developers/rest_api.markdown | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/developers/rest_api.markdown b/source/developers/rest_api.markdown index f4046b3cb9a..ede8f8157b2 100644 --- a/source/developers/rest_api.markdown +++ b/source/developers/rest_api.markdown @@ -202,11 +202,11 @@ $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \ #### {% linkable_title GET /api/history/period/<timestamp> %} Returns an array of state changes in the past. Each object contains further details for the entities. -The `` is optional and defaults to 1 day before the time of the request. It determines the beginning of the period. +The `` (`YYYY-MM-DDThh:mm:ssTZD`) is optional and defaults to 1 day before the time of the request. It determines the beginning of the period. You can pass the following optional GET parameters: - `filter_entity_id=` to filter on a single entity - - `end_time=` to choose the end of the period (defaults to 1 day) + - `end_time=` to choose the end of the period in URL encoded format (defaults to 1 day). ```json [ @@ -227,8 +227,8 @@ You can pass the following optional GET parameters: "unit_of_measurement": "\u00b0C" }, "entity_id": "sensor.weather_temperature", - "last_changed": "2016-02-06T22:15:00+00:00"", - "last_updated": "2016-02-06T22:15:00+00:00"", + "last_changed": "2016-02-06T22:15:00+00:00", + "last_updated": "2016-02-06T22:15:00+00:00", "state": "-1.9" }, ] @@ -249,6 +249,12 @@ $ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \ http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?filter_entity_id=sensor.temperature ``` +```bash +$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \ + -H "Content-Type: application/json" \ + http://localhost:8123/api/history/period/2016-12-29T00:00:00+02:00?end_time=2016-12-31T00%3A00%3A00%2B02%3A00 +``` + #### {% linkable_title GET /api/states %} Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.