Development Document

Bandwidth and Volume Traffic Download PDF Document

Endpoint

Request URL: stat/bandwidth (GET)

Endpoint Domain Name: cdn.api.baishan.com
Endpoint Version: v2

Endpoint Description

Use this API to monitor your service’s bandwidth and traffic volume. When multiple domain names are passed in, the sum of the total bandwidth/volume is returned. Unit: bit/second. When the domains variable is set to all, the sum of all active domain’s bandwidth/volume is returned. (Deleted or suspended domains are not taken into the calculation.)

Notice: The default data statistical granularity is 5 minutes. When the bandwidth is 0, it is not displayed by default. See the Response Header section for information on call frequency limit.

API Parameters

Notice: Please request the API token from your account team.

Request Parameters (GET)

Add request parameters to the URL query strings, i.e. ?key1=value1&key2=value2.

ParameterData TypeRequirementDescription
domainsstringRequiredDomain 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_timestringRequiredStart 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_timestringRequiredEnd 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.
gradstringNot RequiredGranularity 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.
data_typestringNot RequiredType of data to retrieve, such as traffic or bandwidth. The value is bandwidth by default.
ip_protocolstringNot RequiredIP Protocol of the data, such as ipv6 and ipv4, The value is all(total IP Protocol) by default.

Sample Request:

curl -X GET "https://cdn.api.baishan.com/v2/stat/bandwidth?token=xxx&start_time=2017-02-03 12:14&end_time=2017-02-03 12:30&domains=all"

Sample Response

Json format.

{
    "code": 0,//code 0 means success
    "data": [
        [
            1503244800, //Time stamp, minute 5 granularity
            208706182.29 //Bandwidth value in bps
        ],
        [
            1503245100,
            202799878.64
        ],
        [
            1503330600,
            248881899.04
        ],
        [
            1503330900,
            242017854.58
        ]
    ]
}

Response Header

HTTP/1.0 200 OK
Api-Id:                1039
Content-Type:          application/json; charset=utf-8
X-Ratelimit-Grad:      minute  //Unit of the request number limit
X-Ratelimit-Limit:     300  // 300 requests (calls) per minutes maximum
X-Ratelimit-Remaining: 99   //99 calls left for the current minute
X-Retry-After:         21  //the rate limit resets in 21 seconds

HTTP Status Codes

Error CodeDescription
404Bad request URLs.
401Authorization Error: Invalid token or lack of access.
400Bad request parameters.
200Success.
5xxPlease contact your account team.
CopyRight © 2015-2022 BaishanCloud . All Rights Reserved.