API - Список соединений/en

Материал из WebHMI Wiki
Перейти к: навигация, поиск
Эта страница — перевод страницы API - Список соединений. Перевод выполнен на 94%.

Другие языки:
English • ‎русский
Другие языки:
English • ‎русский

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:

idintUnique connection Id
titlestringConnection name
addrstring Bus address or network address for TCP connection
baudrateint Communication speed for serial connections
paritystringParity check for serial connections. e = Even, o = Odd, n = None
stopbitintNumber of stop bits for serial connectoins
modelintId of the device type
protocolintId of the communication protocol
timeoutintMaximal timeout for waiting response from device
devicestringSystem adapter name of the serial connections
disabledint0 = connection is active, 1 = connection is disabled
modeint0 = 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