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 of query for the full graph list:») |
||
Строка 16: | Строка 16: | ||
− | + | Example of query for the full graph list: | |
'''URL''': http://192.168.1.1/api/graphs<br> | '''URL''': http://192.168.1.1/api/graphs<br> |
Версия 07:37, 16 апреля 2018
To get a list of all graphs, you must perform a GET request on the URL like this: http://192.168.1.1/api/graphs.
To obtain information about a particular graph, you must perform a following GET request on a URL 'http://192.168.1.1/api/graphs/1' . Here "1" is the ID of the desired graph.
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 of query for the full graph list:
URL: http://192.168.1.1/api/graphs
Method: GET
Заголовки:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Пример ответа:
[ { "id": "1", "regsid": "10,11", "title": "Горелка 1 и 2", "height": "350", "min_val": "0", "max_val": "" }, { "id": "2", "regsid": "8", "title": "Температура в печи", "height": "350", "min_val": "0", "max_val": "200" } ]
Пример запроса информации о графике номер 2:
URL: http://192.168.1.1/api/graphs/2
Method: GET
Заголовки:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Пример ответа:
{ "id": "2", "regsid": "8", "title": "Температура в печи", "height": "350", "min_val": "0", "max_val": "200" }
Атрибуты графика:
id | int | Уникальный идентификатор графика |
title | string | Название графика |
regsid | string | Список идентификаторов регистров которые необходимо отображать на графике. Регистры разделены запятыми. |
height | int | Высота графика в пикселях |
min_val | double | Минимальное значение оси Y |
max_val | double | Максимальное значение оси Y |