Users API
Users used to control access to the Astra Web Interface as well as access to the HTTP MPEG-TS and HLS outputs
User configuration
Section titled “User configuration”{ "enable": true, "type": 0, "comment": "...",
"token": "...", "ip": "...", "expire": 0, "conlimit": 0}enable– enabled account or nottype– user type1- admin. full access to the Astra Web Interface2- observer. read only access to the Astra Web Interface3- regular user. without access to the Astra Web Interface
comment- optional field, for user description
Optional fields for buil-in authorization to access HLS or HTTP MPEG-TS channels:
token- token used in HTTP requests. For example:http://server:8000/play/a001/index.m3u8?token=secretip- allow access to the channels by the client IP addressexpire- date in unix timestamp format, when access to channels will be restrictedconnlimit- limit connections to channels
Get user
Section titled “Get user”Request: POST /control/
{ "cmd": "get-user", "id": "..."}id- user login
In response will be JSON with user configuration
Create or update user
Section titled “Create or update user”Request: POST /control/
{ "cmd": "set-user", "id": "...", "user": { "enable": true, "type": 0, "password": "..." }}id– user loginuser- user configurationpassword- plain password, in the config will be saved the password hash
Example
You may create new user by launching next command:
curl -X POST --user login -d @- http://server:8000/control/ <<END{ "cmd": "set-user", "id": "new-admin", "user": { "enable": true, "type": 1, "password": "secret" }}ENDon success Astra returns:
{ "set-user": "ok" }Remove user
Section titled “Remove user”Request: POST /control/
{ "cmd": "set-user", "id": "...", "user": { "remove": true }}Toggle user
Section titled “Toggle user”Request: POST /control/
Turn user on or off:
{ "cmd": "toggle-user", "id": "..."}id- user login
Example
You may enable or disable user by launching next command:
curl \ -X POST \ --user login \ -d '{"cmd":"toggle-user", "id":"login"}' \ http://server:8000/control/on success Astra returns:
{ "toggle-user": "ok" }