API - Список панелей/en — различия между версиями

Материал из WebHMI Wiki
Перейти к: навигация, поиск
(Новая страница: «Dashboards attributes:»)
(Новая страница: «<table> <tr><td>'''id'''</td><td>int</td><td>Unique dashboard identifier</td></tr> <tr><td>'''title'''</td><td>string</td><td>Dashboard name</td></tr> <tr><td>'''…»)
Строка 80: Строка 80:
  
 
<table>
 
<table>
<tr><td>'''id'''</td><td>int</td><td>Уникальный идентификатор панели</td></tr>
+
<tr><td>'''id'''</td><td>int</td><td>Unique dashboard identifier</td></tr>
<tr><td>'''title'''</td><td>string</td><td>Название панели</td></tr>
+
<tr><td>'''title'''</td><td>string</td><td>Dashboard name</td></tr>
<tr><td>'''hide_title'''</td><td>int</td><td>0 = отображать название панели, 1 = спрятать название панели</td></tr>
+
<tr><td>'''hide_title'''</td><td>int</td><td>0 = display dashboard name , 1 = hide dashboard name</td></tr>
<tr><td>'''width'''</td><td>int</td><td>Ширина рабочей области панели в пикселях</td></tr>
+
<tr><td>'''width'''</td><td>int</td><td>Working area width in pixels</td></tr>
<tr><td>'''height'''</td><td>int</td><td>Высота рабочей области панели в пикселях</td></tr>
+
<tr><td>'''height'''</td><td>int</td><td>Working area height in pixels</td></tr>
 
</table>
 
</table>

Версия 09:35, 18 апреля 2018

To get a list of all panels, you must perform a GET request on the URL like this: http://192.168.1.1/api/dashboards.

To obtain information about a particular dashboard, you must perform a following GET request on a URL 'http://192.168.1.1/api/graphs/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


An example of querying a list of dashboards:

URL: http://192.168.1.1/api/dashboards
Method: GET

Headers:

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

Example of response:

[
  {
    "id": "1",
    "title": "Упаковка",
    "hide_title": "0",
    "width": "900",
    "height": "450"
  },
  {
    "id": "2",
    "title": "Расход воды",
    "hide_title": "1",
    "width": "1024",
    "height": "800"
  }
]


Example of requesting information on dashboard number 1:

URL: http://192.168.1.1/api/dashboards/1
Method: GET

Headers:

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

Example of reply:

{
  "id": "1",
  "title": "Упаковка",
  "hide_title": "0",
  "width": "900",
  "height": "450"
}


Dashboards attributes:

idintUnique dashboard identifier
titlestringDashboard name
hide_titleint0 = display dashboard name , 1 = hide dashboard name
widthintWorking area width in pixels
heightintWorking area height in pixels