Depending on the task, you can work with the SDK by: indicating an SDK password, explicitly indicating the username and password of an arbitrary user in each request, or by using a session.
If the request includes only a password and not a username, the system will treat the request as being made using the SDK password with the rights of the Script user; if the username is indicated, the request will be made with the rights of the corresponding user. To avoid passing your credentials with every request, you can use a session. However, many commands require a session.
General form of a request that uses the SDK password:
https://server_address:port/command?password=password
General form of a request that uses the username and password of an arbitrary user:
https://server_address:port/command?username=user&password=password
General form of a request that uses a session:
https://server_address:port/command?sid=session_id
Key elements of the request:
- server_address - the IPV4 IP address of the TRASSIR server, or its NetBios name, for example: 192.168.1.1, or videoserver;
- port - the TRASSIR server port for connecting to the SDK, for example: 8080;
- command - the actual request that needs to be executed, for example: health;
- user - the username under which the operation will be executed, for example: Admin;
- password - the user's password, for example: 987654321;
- session_id - the ID for the obtained session, for example: e03qD0eg;
Tip
Note that the request must begin with https:// (the HTTPS protocol is used).
Examples of requests:
https://192.168.1.200:8080/health?username=Admin&password=987654321 https://192.168.1.200:8080/health?password=12345 https://192.168.1.200:8080/health?sid=e03qD0eg
In the examples of requests given above, data is transmitted to the server using the GET method. You can also use the POST method. Below is an example of a simple HTML form that illustrates this approach:
<html> <body> <form action="https://192.168.1.200:8000/objects/" method="POST"> <label for="password">Enter SDK password:</label> <input id="password" type="password" name="password"> <input type="submit" value="Send"> </form> </body> </html>
All of the examples that follow use the GET method in connection with a session.