EdgeNext
Documentation home

EdgeNext Documentation

Product guides, setup instructions, and technical references.

CDN

Bandwidth Traffic Query

Endpoint

Request URL: stat/bandwidth (GET)

API Host: cdn.api.edgenext.com
API Version: v2

Description

Retrieves bandwidth or traffic statistics for one or more accelerated domains.

The default data aggregation interval is 5 minutes. API rate limits are returned in the Response Headers.

Input Parameters

Public Parameters: Contact the on-duty support engineer to obtain your API token.

Request Parameters (GET)

Append the following parameters to the URL query string. For example:

?key1=value1&key2=value2
Parameter Type Required Description
domains string Yes Specifies the accelerated domain(s) to query. Up to 10 domains can be queried in a single request. When multiple domains are specified, aggregated statistics for all specified domains are returned. Specify all to retrieve aggregated statistics for all accelerated domains under the current account.
start_time string Yes Specifies the start time of the query. Examples: 2020-06-01 10:00 or 2020-06-01. If only the date is specified, the start time defaults to 2020-06-01 00:00:00. Returned data begins at or after the specified time and is aligned to the selected aggregation interval. For example, when using the 5-minute interval, 2020-06-01 10:03 is aligned to 2020-06-01 10:00. The maximum time range between the start and end time is 31 days.
end_time string Yes Specifies the end time of the query. Examples: 2020-06-02 10:00 or 2020-06-02. If only the date is specified, the end time defaults to 2020-06-02 23:59:59. Returned data ends at or before the specified time and is aligned to the selected aggregation interval. For example, when using the 5-minute interval, 2020-06-02 10:17 is aligned to 2020-06-02 10:15. The maximum time range between the start and end time is 31 days.
start_timestamp string No Specifies the start time as a 10-digit UNIX timestamp. If both timestamp and datetime parameters are provided, start_timestamp and end_timestamp take precedence.
end_timestamp string No Specifies the end time as a 10-digit UNIX timestamp. If both timestamp and datetime parameters are provided, start_timestamp and end_timestamp take precedence.
data_type string No Specifies the metric to query.
bandwidth — Bandwidth (bps)
traffic — Traffic (bytes)
Default: bandwidth
grad string No Specifies the data aggregation interval.
minute — 1 minute
minute5 — 5 minutes
hour — 1 hour
day — 1 day
Default: minute5
protocol_type string No Filters statistics by protocol.
http — HTTP only
https — HTTPS only
By default, aggregated statistics for both HTTP and HTTPS are returned.
ip_protocol string No Filters statistics by IP protocol.
ipv4 — IPv4 only
ipv6 — IPv6 only
By default, aggregated statistics for both IPv4 and IPv6 are returned.
query_area string No Filters statistics by service region.
all (default) — Global
cn — Mainland China
abroad — Overseas
Supported country and region codes include:
vn (Vietnam), sg (Singapore), th (Thailand), my (Malaysia), ph (Philippines), id (Indonesia), in (India), mm (Myanmar), la (Laos), kh (Cambodia), bd (Bangladesh), br (Brazil), jp (Japan), kr (South Korea), pk (Pakistan), ru (Russia), it (Italy), ng (Nigeria), gb (United Kingdom), ir (Iran), bh (Bahrain), kw (Kuwait), ca (Canada), hk (Hong Kong SAR), mo (Macao SAR), and tw (Taiwan). Region codes can also be obtained through the Country and Region List API.

Request Example

# URL-encode the request parameters before sending the request.
curl -X GET "https://cdn.api.edgenext.com/v2/stat/bandwidth?token=xxx\
&domains=example.com,example2.com\
&start_time=2020-06-01%2012:16\
&end_time=2020-06-01%2012:30"

Response Example

JSON

Success

{
    "code": 0, // A value of 0 indicates that the request was successful.
    "data": [
        [
            1590984900, // UNIX timestamp in ascending order.
            208706182.29 // Value of the selected metric specified by data_type.
        ],
        [
            1590985200,
            202799878.64
        ],
        [
            1590985500,
            248881899.04
        ],
        [
            1590985800,
            242017854.58
        ]
    ]
}

Error

{
    "code": 400101,
    "message": "domain(life.com) is invalid"
}

Response Headers

HTTP/1.0 200 OK
Api-Id:                1039
Content-Type:          application/json; charset=utf-8
X-Ratelimit-Grad:      minute        // Rate limit interval (minute/hour/day)
X-Ratelimit-Limit:     300           // Maximum requests allowed during the current interval
X-Ratelimit-Remaining: 99            // Remaining requests available during the current interval
X-Retry-After:         21            // Number of seconds until the rate limit resets

HTTP Status Codes

Status Code Description
200 Request completed successfully.
400 Invalid request parameters.
401 Authentication failed. The API token is invalid, or your account does not have permission to access this API.
404 The requested URL could not be found.
5xx Internal server error. Please contact the on-duty support engineer.

Need help? Contact our support team at support@edgenext.com.

Back to documentation home