API - Получение данных о локальном времени/en — различия между версиями

Материал из WebHMI Wiki
Перейти к: навигация, поиск
(Новая страница: «Also, in the headers, you must specify the desired data exchange format. Currently, only the [https://ru.wikipedia.org/wiki/JSON JSON] format is supported. <pre>…»)
(Новая страница: «Example:»)
Строка 14: Строка 14:
  
  
Пример:
+
Example:
  
 
'''URL''': http://192.168.1.1/api/timeinfo<br>
 
'''URL''': http://192.168.1.1/api/timeinfo<br>

Версия 09:25, 18 апреля 2018

To get local time data, you must perform a GET request on the URL like this: http://192.168.1.1/api/timeinfo.

In the headers, it is necessary to pass API key. For example:

X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7

Also, in the headers, you must specify the desired data exchange format. Currently, only the JSON format is supported.

Accept: application/json
Content-Type: application/json


Example:

URL: http://192.168.1.1/api/timeinfo
Method: GET

Заголовки:

Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip, deflate, sdch
X-WH-APIKEY:F3C74230818DA487BB2017CE5D0290F4DABCAFD7

Пример ответа:

{
  "timestamp": 1422861826,
  "timezone": "EET",
  "gmtoffset": 7200,
  "isdst": 0
}

Атрибуты даты и времени:

timestampunixtimeТекущее время в формате unixtime
timezonestringНазвание временной зоны
gmtoffsetintСмещение местного времени от UTC в секундах
isdstint0 = зимнее время, 1 = летнее время