[ENG] 14.1. [DKSF 53/203.1 IU] Controlling IO Lines

HTTP API in thye device can be used for the integration with web applications without using an SNMP protocol. Controlling IO lines is available through HTTP API.

Requesting a Status of an IO Line

http://192.168.0.100/io.cgi?ioN

where:

N  is a number of a line, indicated after ?io.

Returned Values

Error (incorrect request format or incorrect number of an IO line):

 io_result('error')

Successful execution of a command:

io_result('ok', -1, 1, 339)

The first argument is always 'ok' (when there is an error in a request - 'error').

The second argument is always «-1», for the extending of the API in future.

The third argument is a current instantaneous status of an IO line, including a reset status.

The fourth argument is a pulse counter on the IO line.

The name of the JSON-P callback is fixed io_result(), and cannot be changed in a request.

Switching the Line (in the Output Mode)

Switching to the status «0» or «1»:

http://192.168.0.100/io.cgi?ioN=0

http://192.168.0.100/io.cgi?ioN=1

where:

N  is a number of a line, indicated after ?io.


Switching to the alternative (inverted) status.

http://192.168.0.100/io.cgi?ioN=f

where:

N  is a number of a line, specified after ?io.


Short term switching to the inverted status, i.e. issuing a pulse

http://192.168.0.100/io.cgi?ioN=f,5

where:

N  is a number of a line, indicated after ?io.

Duration in seconds is set after a comma.

Choosing the Operation Mode of an IO Line

Setting the operation mode of a line: «0» - input, «1» - output, «2» - output of logic:

http://192.168.0.100/io.cgi?ioN&mode=0

http://192.168.0.100/io.cgi?ioN&mode=1

http://192.168.0.100/io.cgi?ioN&mode=2

where:

N  is a number of a line, specified after ?io.

Returned Values

Error (incorrect request format or incorrect number of an IO line):

io_result('error')

A command is executed:

io_result('ok')

Authorization

To add a login and password to the structure of a URL-encoded command, it is possible to use the next scheme:

  • http://<username>:<password>@<host>:<port>/<URL‐path>?<parameters>

where:

<username>:<password> – are credentials for authorization in a device web interface;

<host>  is an IP address of a device;

<port>  is a port of an HTTP server;

<URL‐path>?<parameters>  is a URL-encoded command