Querying the Number of Online Viewers
Function
This API is used to query the number of online viewers.
URI
GET /v1/{project_id}/stream/users
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see "Obtaining a Project ID" . |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
domain |
Yes |
String |
Streaming domain name |
|
app_name |
No |
String |
Application name. |
|
stream_name |
No |
String |
Stream name |
|
start_time |
No |
String |
Start time in the format of yyyy-MM-ddThh:mm:ssZ (UTC time) If the start time is not specified, the number of online viewers in the last statistical period is queried. |
|
end_time |
No |
String |
End time in the format of yyyy-MM-ddTHH:mm:ssZ (UTC time).
|
|
step |
No |
Integer |
Statistical period Unit: minute |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. The token is obtained by calling the IAM API used to obtain a user token. The token is the value of X-Subject-Token in the response header. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
total |
Integer |
Total number of elements in the query result |
|
user_info |
Array of UserInfo objects |
Audio and video information that is being pushed |
|
Parameter |
Type |
Description |
|---|---|---|
|
user_num |
Integer |
Number of online viewers |
|
timestamp |
String |
Push time in the format of yyyy-MM-ddTHH:mm:ssZ (UTC time) |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error Code |
|
error_msg |
String |
Error description |
Example Requests
GET https://{endpoint}/v1/{project_id}/stream/users?domain=play.example.huawei.com&app_name=live&stream_name=xxx
Example Responses
Status code: 200
Number of online viewers queried successfully.
{
"total" : 1,
"user_info" : [ {
"user_num" : 1024,
"timestamp" : "2018-05-19T21:10:15Z"
} ]
}
Status code: 400
Failed to query the number of online viewers.
{
"error_code" : "LIVE.100011001",
"error_msg" : "Request Illegal"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Number of online viewers queried successfully. |
|
400 |
Failed to query the number of online viewers. |
Error Codes
See Error Codes.
Last Article: Querying Traffic Data
Next Article: Statistics Analysis
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.