![2N Indoor Touch Скачать руководство пользователя страница 24](http://html1.mh-extra.com/html/2n/indoor-touch/indoor-touch_api-manual_3088993024.webp)
2N TELEKOMUNIKACE a.s., www.2n.cz
24/42
4.1 Interface
Communication is made via the HTTPS protocol, which runs on standardised port 443.
Authentication requires login and password data to be transmitted in the first
connection. Subsequently, the server returns the client a cookie with a session key for
further requests. Having failed to send more requests within a timeout (20 minutes at
present), the client will be logged out automatically. The next requests will thus return
the HTTP return code 401 (Not authorised). Then the client has to log in again.
4.1.1 Requests
The client-server communication is used. The client sends a data/command execution
request and the server sends a response. The request consists of URL and optional
data in the following format:
https:
//<IP>/api/v1/<subsystem>?<parameters>
IP is the IDT IP address
<subsystem> designates the system part to be controlled
<parameters> includes request details
For example:
https:
//192.168.254.228/api/v1/gpio?
action=set&name=io2&type=direction&value=out
means that the client wants to switch the GPIO pin to output in the GPIO subsystem.
If the data to be transferred are rather extensive, store the data in the JSON format in
the HTTP request body (Content-Type: application/json; charset=UTF-8).
Refer to the list of command parameters for these exceptions.
The HTTP method GET is used for the requests that do not transmit data. The PUT
method is used for the requests that include data.
4.1.2 Responses to Requests
A response to a request always includes JSON data in the following format: