Querying Traffic Data
Function
This API is used to query traffic data of a streaming domain name.
URI
GET /v1/{project_id}/stream/traffic
|
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 |
No |
String |
Streaming domain name. If no domain names are specified, the total traffic of all domain names in each account is queried. |
|
start_time |
No |
String |
Start time in the format of yyyy-MM-ddTHH:mm:ssZ (UTC time) |
|
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 |
|
traffic_info |
Array of TrafficInfo objects |
Traffic information |
|
Parameter |
Type |
Description |
|---|---|---|
|
traffic |
Integer |
Total traffic in a statistical period, in bytes |
|
timestamp |
String |
Start time of a sampling period. The value is UTC time in the format of yyyy-MM-ddTHH:mm:ssZ. |
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/traffic?domain=play.example.huawei.com
Example Responses
Status code: 200
Traffic data queried successfully.
{
"total" : 1,
"traffic_info" : [ {
"traffic" : 1024,
"timestamp" : "2018-05-19T21:10:15Z"
} ]
}
Status code: 400
Failed to query traffic data.
{
"error_code" : "LIVE.100011001",
"error_msg" : "Request Illegal"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Traffic data queried successfully. |
|
400 |
Failed to query traffic data. |
Error Codes
See Error Codes.
Last Article: Querying Bandwidth Data
Next Article: Querying the Number of Online Viewers
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.