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

Материал из WebHMI Wiki
Перейти к: навигация, поиск
(Новая страница: «Example:»)
 
(не показано 5 промежуточных версий этого же участника)
Строка 1: Строка 1:
 +
<languages/>
 
To get local time data, you must perform a GET request on the URL like this: '''http://192.168.1.1/api/timeinfo'''.
 
To get local time data, you must perform a GET request on the URL like this: '''http://192.168.1.1/api/timeinfo'''.
  
Строка 19: Строка 20:
 
'''Method''': GET
 
'''Method''': GET
  
Заголовки:
+
Headers:
 
<pre>
 
<pre>
 
Accept: application/json
 
Accept: application/json
Строка 27: Строка 28:
 
</pre>
 
</pre>
  
Пример ответа:
+
Response example:
 
<pre>
 
<pre>
 
{
 
{
Строка 38: Строка 39:
 
----
 
----
  
Атрибуты даты и времени:
+
Date and time attributes:
  
 
<table>
 
<table>
<tr><td>'''timestamp'''</td><td>unixtime</td><td>Текущее время в формате unixtime</td></tr>
+
<tr><td>'''timestamp'''</td><td>unixtime</td><td>Current time in unixtime format</td></tr>
<tr><td>'''timezone'''</td><td>string</td><td>Название временной зоны</td></tr>
+
<tr><td>'''timezone'''</td><td>string</td><td>Time zone name</td></tr>
<tr><td>'''gmtoffset'''</td><td>int</td><td>Смещение местного времени от UTC в секундах</td></tr>
+
<tr><td>'''gmtoffset'''</td><td>int</td><td>Local time offset from UTC in seconds</td></tr>
<tr><td>'''isdst'''</td><td>int</td><td>0 = зимнее время, 1 = летнее время</td></tr>
+
<tr><td>'''isdst'''</td><td>int</td><td>0 = winter time, 1 = summer time</td></tr>
 
</table>
 
</table>

Текущая версия на 09:57, 18 апреля 2018

Другие языки:
English • ‎русский

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

Headers:

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

Response example:

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

Date and time attributes:

timestampunixtimeCurrent time in unixtime format
timezonestringTime zone name
gmtoffsetintLocal time offset from UTC in seconds
isdstint0 = winter time, 1 = summer time