Request URL: stat/bandwidth/eachDomain (GET)
Endpoint Domain Name:
cdn.api.baishan.com
Endpoint Version:v2
Use this API to retrieve bandwidth/traffic metrics for individual host names. The unit for bandwidth is bit/second and for traffic is bytes.
Notice: The default data granularity is 5-minute.
Notice: Please request the API token from your account team.
Add request parameters to the URL query strings, i.e. ?key1=value1&key2=value2.
Parameter | Data Type | Requirement | Description |
---|---|---|---|
domains | string | Required | Domain names. Separate domain names by a comma (,). Up to 10 domain names at a time. all means all domains names, For example, aa.qingcdn.com,bb.qingcdn.com |
start_time | string | Required | Start time in the format of YYYY-mm-dd or YYYY- mm-dd HH:ii. For example, 2017-04-26 retrieves bandwidth/traffic data starting at 2017-04-26 00:00. |
end_time | string | Required | End time in the format of YYYY-mm-dd or YYYY- mm-dd HH:ii. For example, 2017-04-26 retrieves bandwidth/traffic data ending at 2017-04-26 23:59. The end time has to be greater than start time but must be within the range of 31 days. |
grad | string | Not Required | Granularity of the data. minute5 by default. The options are minute5 (5 minutes), hour , or day . When choosing minute5 , the start time to end time range can not exceed 10 days. |
query_area | string | Not Required | all (default): total global bandwidth; cn : China bandwidth; abroad : outside of China bandwidth.;vn : Vietnam; sg : Singapore; th : Thailand; my : Malaysia; ph : Philippines; id : Indonesia; in : India; mm : Myanmar |
stat_is_forward | string | Not Required | 0 (default): pointing backward, for example, 2016- 03-16 10:00 means [2016-03-16 10:00, 2016-03-16 10:04]. 1 : pointing forward, for example, 2016-03-16 10:05 means [2016-03-16 10:00, 2016-03-16 10:04]. |
data_type | string | Not Required | Type of data to retrieve, such as traffic or bandwidth . The value is bandwidth by default. |
ip_protocol | string | Not Required | IP Protocol of the data, such as ipv6 and ipv4 , The value is all (total IP Protocol) by default. |
curl -X GET
"https://cdn.api.baishan.com/v2/stat/bandwidth/eachDomain?domains=aa.qingcdn.com,bb.qingcdn.com&end_time=2017-08-21 12:00&start_time=2017-08-21 11:00&query_area=cn&token=xxx" -k
Json format.
{
"code": 0,//code 0 means success
"data": {
"aa.qingcdn.com": {
"domain": "aa.qingcdn.com",
"data": [
[
1503284700,// Time stamp, granularity is 5-minute
1988666.56// Bandwidth value in bps
],
[
1503285000,
3001901.81
],
...
]
},
"bb.qingcdn.com": {
"domain": "bb.qingcdn.com",
"data": [
[
1503284700,// Time stamp, granularity is 5-minute
1988666.56// Bandwidth value in bps
],
[
1503285000,
3001901.81
],
...
]
}
}
}
HTTP/1.0 200 OK
Api-Id: 8335139
Content-Type: application/json; charset=utf-8
X-Ratelimit-Grad: minute //Unit of the request number limit
X-Ratelimit-Limit: 100 // 100 requests (calls) per minutes maximum
X-Ratelimit-Remaining: 99 //99 calls left for the current minute
X-Retry-After: 16 //the rate limit resets in 16 seconds
Error Code | Description |
---|---|
404 | Bad request URLs. |
401 | Authorization Error: Invalid token or lack of access. |
400 | Bad request parameters. |
200 | Success. |
5xx | Please contact your account team. |