API - Список изображений/en — различия между версиями
Материал из WebHMI Wiki
(Новая страница: «Image attributes:») |
(Новая страница: «<table> <tr><td>'''id'''</td><td>int</td><td>Unique image identifier</td></tr> <tr><td>'''title'''</td><td>string</td><td>Image name</td></tr> </table>») |
||
Строка 65: | Строка 65: | ||
<table> | <table> | ||
− | <tr><td>'''id'''</td><td>int</td><td> | + | <tr><td>'''id'''</td><td>int</td><td>Unique image identifier</td></tr> |
− | <tr><td>'''title'''</td><td>string</td><td> | + | <tr><td>'''title'''</td><td>string</td><td>Image name</td></tr> |
</table> | </table> |
Версия 09:18, 16 апреля 2018
To get a list of all images, you must perform a GET request on the URL like this: http://192.168.1.1/api/images.
To obtain information about a particular image, you must perform a GET request on a URL like this: 'http://192.168.1.1/api/images/1' . Here "1" is the ID of the desired connection.
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 all images:
URL: http://192.168.1.1/api/images
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Response example:
[ { "id": "1", "title": "Фон" }, { "id": "2", "title": "Пламя" } ]
Example of querying information for image #2:
URL: http://192.168.1.1/api/images/2
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY: F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Example of reply:
Image attributes:
id | int | Unique image identifier |
title | string | Image name |