API - Список графиков/en — различия между версиями
Материал из WebHMI Wiki
(Новая страница: «Graph's attributes:») |
(Новая страница: «<table> <tr><td>'''id'''</td><td>int</td><td>Unique graph identifier</td></tr> <tr><td>'''title'''</td><td>string</td><td>Graph name</td></tr> <tr><td>'''regsid''…») |
||
Строка 83: | Строка 83: | ||
<table> | <table> | ||
− | <tr><td>'''id'''</td><td>int</td><td> | + | <tr><td>'''id'''</td><td>int</td><td>Unique graph identifier</td></tr> |
− | <tr><td>'''title'''</td><td>string</td><td> | + | <tr><td>'''title'''</td><td>string</td><td>Graph name</td></tr> |
− | <tr><td>'''regsid'''</td><td>string</td><td> | + | <tr><td>'''regsid'''</td><td>string</td><td> List of registers ids to be displayed on the graph.</td></tr> |
− | <tr><td>'''height'''</td><td>int</td><td> | + | <tr><td>'''height'''</td><td>int</td><td>Graph height in pixels</td></tr> |
− | <tr><td>'''min_val'''</td><td>double</td><td> | + | <tr><td>'''min_val'''</td><td>double</td><td>Minimal value of the Y axis</td></tr> |
− | <tr><td>'''max_val'''</td><td>double</td><td> | + | <tr><td>'''max_val'''</td><td>double</td><td>Maximal value of the Y axis</td></tr> |
</table> | </table> |
Версия 07:39, 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
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Reply example:
[ { "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" } ]
Example of obtaining information about graph #2:
URL: http://192.168.1.1/api/graphs/2
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Response example:
{ "id": "2", "regsid": "8", "title": "Температура в печи", "height": "350", "min_val": "0", "max_val": "200" }
Graph's attributes:
id | int | Unique graph identifier |
title | string | Graph name |
regsid | string | List of registers ids to be displayed on the graph. |
height | int | Graph height in pixels |
min_val | double | Minimal value of the Y axis |
max_val | double | Maximal value of the Y axis |