API - Список соединений/en
To get a list of all connections, you must perform a GET request on the URL like this: http://192.168.1.1/api/connections.
To obtain information about a particular connection, you must perform a GET request on a URL like this: 'http://192.168.1.1/api/connections/1' . Here "1" is the ID of the desired connection.
In the request 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 connection list request:
URL: http://192.168.1.1/api/connections
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY:F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Example of a response:
[ { "id": "1", "title": "Internal registers", "addr": "", "baudrate": "9600", "parity": "e", "stopbit": "1", "bitscount": "8", "model": "3", "protocol": "4", "timeout": "100", "timeout2": "", "device": "/dev/rs485", "disabled": "0", "mode": "0" }, { "id": "2", "title": "S7 200", "addr": "2", "baudrate": "9600", "parity": "e", "stopbit": "1", "bitscount": "8", "model": "1", "protocol": "3", "timeout": "200", "timeout2": "", "device": "/dev/rs485", "disabled": "1", "mode": "0" } ]
Example of a request for connection #2 information:
URL: http://192.168.1.1/api/connections/2
Method: GET
Headers:
Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate, sdch X-WH-APIKEY:F3C74230818DA487BB2017CE5D0290F4DABCAFD7
Example of a response:
{ "id": "2", "title": "S7 200", "addr": "2", "baudrate": "9600", "parity": "e", "stopbit": "1", "bitscount": "8", "model": "1", "protocol": "3", "timeout": "200", "timeout2": "", "device": "/dev/rs485", "disabled": "1", "mode": "0" }
Connection attributes:
id | int | Unique connection Id |
title | string | Connection name |
addr | string | Bus address or network address for TCP connection |
baudrate | int | Communication speed for serial connections |
parity | string | Parity check for serial connections. e = Even, o = Odd, n = None |
stopbit | int | Number of stop bits for serial connectoins |
model | int | Id of the device type |
protocol | int | Id of the communication protocol |
timeout | int | Maximal timeout for waiting response from device |
device | string | System adapter name of the serial connections |
disabled | int | 0 = connection is active, 1 = connection is disabled |
mode | int | 0 = normal mode. 1 = Virtual UART mode |
Id of the device type:
0 = Delta DVP
1 = Siemens Simatic S7 200
2 = Generic ModBus
3 = Internal WebHMI Registers
4 = Generic Owen
5 = Generic DF1
Ids of the communication protocols:
0 = ModBus ASCII
1 = ModBus RTU
2 = ModBus TCP
3 = Siemens PPI
4 = Owen
5 = Allen Bradley DF1
6 = Internal WebHMI Registers