API - Список трендов/en — различия между версиями
Материал из WebHMI Wiki
(Новая страница: «In the headers, it is necessary to pass API key. For example: <pre> X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7 </pre>») |
(Новая страница: «Also, in the headers, you must specify the desired data exchange format. Currently, only the [https://en.wikipedia.org/wiki/JSON JSON] format is supported. <pre>…») |
||
Строка 8: | Строка 8: | ||
</pre> | </pre> | ||
− | + | Also, in the headers, you must specify the desired data exchange format. Currently, only the [https://en.wikipedia.org/wiki/JSON JSON] format is supported. | |
<pre> | <pre> | ||
Accept: application/json | Accept: application/json |
Версия 07:25, 16 апреля 2018
To get a list of all registers, you must perform a GET request on the URL like this: http://192.168.1.1/api/registers.
To obtain information about a particular register, you must perform a following GET request on a URL 'http://192.168.1.1/api/registers/1' . Here "1" is the ID of the desired register.
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
Пример запроса списка всех трендов:
URL: http://192.168.1.1/api/trends
Method: GET
Заголовки:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Пример ответа:
[ { "id": "1", "regsid": "16", "title": "Горелка", "height": "350", "min_val": "0", "max_val": "" }, { "id": "2", "regsid": "11,12,13", "title": "Токи A, B, C", "height": "350", "min_val": "0", "max_val": "1500" } ]
Пример запроса информации о тренде номер 2:
URL: http://192.168.1.1/api/trends/2
Method: GET
Заголовки:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Пример ответа:
{ "id": "2", "regsid": "11,12,13", "title": "Токи A, B, C", "height": "350", "min_val": "0", "max_val": "1500" }
Атрибуты тренда:
id | int | Уникальный идентификатор тренда |
title | string | Название тренда |
regsid | string | Список идентификаторов регистров которые необходимо отображать на тренде. Регистры разделены запятыми. |
height | int | Высота тренда в пикселях |
min_val | double | Минимальное значение оси Y |
max_val | double | Максимальное значение оси Y |