Sessions
The method returns a list of current sessions. Answer format:
{
"cmd": "sessions"
}
The format of the session information: SESSION-INFO:
{
"sessions": [
{
"client_id": N,
"channel_id": "...",
"channel_name": "...",
"addr": "...",
"uptime": N
}
]
}
client_id
— unique number of the sessionchannel_id
— stream IDchannel_name
— stream nameaddr
— The IP address of the client. To get the IP address from HTTP header X-Real-IP or X-Forwarded-For, while proxying requests, you must use the auth_request.uptime
— time, in seconds, since the beginning of the session
To end the session, you must use the close-session method:
{
"cmd": "close-session",
"id": N
}
id
— session number
Other
restart astra
Request:
{
"cmd": "restart"
}
Getting the configuration
Request:
{
"cmd": "load"
}
The answer is the contents of the configuration file.
loading конфигурации
Request:
{
{"cmd":"upload","config":{...}}
}
get user config
{
"cmd": "get-user",
"id": "login"
}
set serial number
{
"cmd": "set-license",
"license": "xxx"
}
Set image in stream tile:
{
"cmd":"set-stream-image",
"id":"a001",
"url":"http://..."
}
Use API
curl
curl -X POST \
--user 'admin:password' \
-d '{"cmd": "api-method"}' \
http://127.0.0.1:8000/control/
127.0.0.1:8000
- is a server address and Astra portadmin:password
- is an admin login and password
php
$req = json_encode(array(
'cmd' => 'api-method',
));
$ch = curl_init("http://127.0.0.1:8000/control/");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "admin:password");
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
127.0.0.1:8000
- is a server address and Astra portadmin:password
- is an admin login and password$res
- is a response data