API - Список блоков панелей/en — различия между версиями
Материал из WebHMI Wiki
(Новая страница: «Block attributes:») |
(Новая страница: «<table> <tr><td>'''id'''</td><td>int</td><td>Unique block identifier</td></tr> <tr><td>'''dashboard_id'''</td><td>string</td><td>Block dashboard-owner identifier…») |
||
Строка 146: | Строка 146: | ||
<table> | <table> | ||
− | <tr><td>'''id'''</td><td>int</td><td> | + | <tr><td>'''id'''</td><td>int</td><td>Unique block identifier</td></tr> |
− | <tr><td>'''dashboard_id'''</td><td>string</td><td> | + | <tr><td>'''dashboard_id'''</td><td>string</td><td>Block dashboard-owner identifier where the block is displayed</td></tr> |
− | <tr><td>'''zindex'''</td><td>int</td><td>Z-index | + | <tr><td>'''zindex'''</td><td>int</td><td>Z-index of block ("layer" number)</td></tr> |
− | <tr><td>'''pos_left'''</td><td>int</td><td> | + | <tr><td>'''pos_left'''</td><td>int</td><td>Position on the dashboards from left edge in pixels</td></tr> |
− | <tr><td>'''pos_top'''</td><td>int</td><td> | + | <tr><td>'''pos_top'''</td><td>int</td><td>Position on the dashboards from top edge in pixels </td></tr> |
− | <tr><td>'''pos_width'''</td><td>int</td><td> | + | <tr><td>'''pos_width'''</td><td>int</td><td>Block height in pixels</td></tr> |
− | <tr><td>'''pos_height'''</td><td>int</td><td> | + | <tr><td>'''pos_height'''</td><td>int</td><td>Block width in pixels</td></tr> |
− | <tr><td>'''block_type'''</td><td>string</td><td> | + | <tr><td>'''block_type'''</td><td>string</td><td> Block type. Options: Indicator, TextValue, Gauge</td></tr> |
− | <tr><td>'''title'''</td><td>string</td><td> | + | <tr><td>'''title'''</td><td>string</td><td>Block name</td></tr> |
− | <tr><td>'''url'''</td><td>string</td><td>URL | + | <tr><td>'''url'''</td><td>string</td><td>URL for links</td></tr> |
− | <tr><td>'''imageid'''</td><td>int</td><td>ID | + | <tr><td>'''imageid'''</td><td>int</td><td>ID of the image to display</td></tr> |
− | <tr><td>'''label'''</td><td>string</td><td> | + | <tr><td>'''label'''</td><td>string</td><td>Text to be displayed in a block</td></tr> |
− | <tr><td>'''align'''</td><td>string</td><td> | + | <tr><td>'''align'''</td><td>string</td><td>Text alignment Options: left, right, center</td></tr> |
− | <tr><td>'''fontsize'''</td><td>int</td><td> | + | <tr><td>'''fontsize'''</td><td>int</td><td>Font size, 1-5</td></tr> |
− | <tr><td>'''regid'''</td><td>int</td><td>ID | + | <tr><td>'''regid'''</td><td>int</td><td>ID of the source register for value</td></tr> |
− | <tr><td>'''is_button'''</td><td>int</td><td>0 = | + | <tr><td>'''is_button'''</td><td>int</td><td>0 = user can change value, 1 = user can not change value</td></tr> |
− | <tr><td>'''hide_value'''</td><td>int</td><td>0 = | + | <tr><td>'''hide_value'''</td><td>int</td><td>0 = display numeric value, 1 = don't display numeric value</td></tr> |
− | <tr><td>'''start_value'''</td><td>double</td><td> | + | <tr><td>'''start_value'''</td><td>double</td><td>Start point value for Gauge block</td></tr> |
− | <tr><td>'''end_value'''</td><td>double</td><td> | + | <tr><td>'''end_value'''</td><td>double</td><td>End point value for Gauge block</td></tr> |
− | <tr><td>'''colorize'''</td><td>int</td><td>0 = | + | <tr><td>'''colorize'''</td><td>int</td><td>0 = display block in black color, 1 = colrize block according to register's state </td></tr> |
</table> | </table> |
Версия 09:49, 18 апреля 2018
To get a list of all dashboard's blocks, you must perform a GET request on the URL like this: http://192.168.1.1/api/blocks.
To obtain information about a particular block, you must perform a following GET request on a URL 'http://192.168.1.1/api/blocks/12' . Here "12" 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 a query for all blocks data:
URL: http://192.168.1.1/api/blocks
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY:F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Example of reply:
[ { "id": "1", "dashboard_id": "1", "zindex": "1", "pos_left": "0", "pos_top": "0", "pos_width": "896", "pos_height": "445", "block_type": "Indicator", "title": "Фон", "url": "", "imageid": "1", "label": "", "align": "", "fontsize": "", "regid": "", "is_button": "false", "hide_value": "false", "start_value": "", "end_value": "", "colorize": "false" }, { "id": "2", "dashboard_id": "1", "zindex": "3", "pos_left": "714", "pos_top": "277", "pos_width": "85", "pos_height": "25", "block_type": "TextValue", "title": "", "url": "", "imageid": "", "label": "", "align": "center", "fontsize": "4", "regid": "3", "is_button": "false", "hide_value": "false", "start_value": "", "end_value": "", "colorize": "false" }, { "id": "3", "dashboard_id": "1", "zindex": "3", "pos_left": "450", "pos_top": "277", "pos_width": "110", "pos_height": "25", "block_type": "TextValue", "title": "", "url": "", "imageid": "", "label": "", "align": "left", "fontsize": "4", "regid": "5", "is_button": "", "hide_value": "", "start_value": "", "end_value": "" } ]
Example of query for block #1 information:
URL: http://192.168.1.1/api/blocks/1
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY:F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Response example:
{ "id": "1", "dashboard_id": "1", "zindex": "1", "pos_left": "0", "pos_top": "0", "pos_width": "896", "pos_height": "445", "block_type": "Indicator", "title": "Фон", "url": "", "imageid": "1", "label": "", "align": "", "fontsize": "", "regid": "", "is_button": "false", "hide_value": "false", "start_value": "", "end_value": "", "colorize": "false" }
Block attributes:
id | int | Unique block identifier |
dashboard_id | string | Block dashboard-owner identifier where the block is displayed |
zindex | int | Z-index of block ("layer" number) |
pos_left | int | Position on the dashboards from left edge in pixels |
pos_top | int | Position on the dashboards from top edge in pixels |
pos_width | int | Block height in pixels |
pos_height | int | Block width in pixels |
block_type | string | Block type. Options: Indicator, TextValue, Gauge |
title | string | Block name |
url | string | URL for links |
imageid | int | ID of the image to display |
label | string | Text to be displayed in a block |
align | string | Text alignment Options: left, right, center |
fontsize | int | Font size, 1-5 |
regid | int | ID of the source register for value |
is_button | int | 0 = user can change value, 1 = user can not change value |
hide_value | int | 0 = display numeric value, 1 = don't display numeric value |
start_value | double | Start point value for Gauge block |
end_value | double | End point value for Gauge block |
colorize | int | 0 = display block in black color, 1 = colrize block according to register's state |