With this article, you can send some basic API commands using Postman. We start by creating the authorization token. After that, you can send the commands. Such as toggling LIVE on/off, selecting a scenario, preset, or camera you want to choose.
Base url: http://{ip}/api
Action | HTTP Method | Endpoint |
Authentication | POST | /manager/auth |
Turning into live mode | POST | /on |
Turning into edit mode | POST | /off |
Switch to scenario | POST | /switch/scenario/{id} |
Switch to preset | POST | /switch/preset/{id} |
Switch to camera output | POST | /switch/camera/{id} |
API Authentication
All the endpoints of the CamDirector are protected by JWT authentication. This means that you need to supply an authentication token to each HTTP request. The following steps will explain how to authenticate with the API and supply the JWT token to you next request. The tutorial makes use of Postman for sending HTTP requests. Postman has an interactive UI for sending requests and simplifies the authentication process.
1. Login with credentials
To retrieve a JWT token you need to make a request to the authentication endpoint. This is a HTTP POST request and requires a JSON body with the username and password fields (don't forget the comma after "admin") of the CamDirector. In the response you will receive your JWT token in the body.
2. Using your JWT token
The token should be supplied in the request header as a Bearer Token. The lifetime of the token is supplied in seconds and is 3600, which means the token is valid for one hour. Only one user can be authenticated at the same time, so when another client logs in other tokens become invalid.
3. Find the ID numbers