CDN
Per-Domain Traffic_Bandwidth Usage Statistics
API Endpoint
Request URL: stat/bandwidth/eachDomain (GET)
API Request Domain:
cdn.api.edgenext.com
API Version:v2
API Description
This API is used to query bandwidth and traffic statistics for multiple accelerated domains. The response returns bandwidth and traffic data for each accelerated domain separately.
The default data aggregation interval is 5 minutes. The API request rate limit can be found in the response headers (Response Header).
Request Parameters
Common Parameters
The user's authentication token is required. Please contact the on-call support team to obtain a valid token.
GET Request Parameters
Request parameters should be added to the query string of the URL.
Example:
?key1=value1&key2=value2
| Parameter Name | Data Type | Required | Description |
|---|---|---|---|
| domains | string | Yes | Specifies the accelerated domains to query. A maximum of 10 accelerated domains can be queried in a single request. When multiple accelerated domains are specified, the API returns bandwidth and traffic statistics for each accelerated domain separately. |
| start_time | string | Yes | Specifies the start time of the query range. Examples: 2020-06-01 10:00, 2020-06-01 If only a date is provided (2020-06-01), the start time is automatically set to 2020-06-01 00:00:00. The returned data includes records greater than or equal to the specified start time. Based on the selected aggregation interval, the time will be rounded down to the nearest interval. Example: When querying 2020-06-01 10:03 with a 5-minute interval, the first returned data point corresponds to 2020-06-01 10:00. The interval between start_time and end_time must not exceed 31 days. |
| end_time | string | Yes | Specifies the end time of the query range. Examples: 2020-06-02 10:00, 2020-06-02 If only a date is provided (2020-06-02), the end time is automatically set to 2020-06-02 23:59:59. The returned data includes records less than or equal to the specified end time. Based on the selected aggregation interval, the time will be rounded down to the nearest interval. Example: When querying 2020-06-02 10:17 with a 5-minute interval, the last returned data point corresponds to 2020-06-02 10:15:00. The interval between start_time and end_time must not exceed 31 days. |
| data_type | string | No | Specifies the metric type to query. traffic: Traffic data, unit: byte bandwidth: Bandwidth data, unit: bps If omitted, the default value is bandwidth. |
| grad | string | No | Specifies the data aggregation interval. minute5: 5-minute interval hour: Hourly interval day: Daily interval If omitted, the default value is minute5. |
| stat_is_forward | string | No | Specifies the meaning of the query timestamp. Example with grad=minute5: 0: The timestamp points forward. For example, 2020-06-01 10:00 represents the interval [2020-06-01 10:00:00, 2020-06-01 10:04:59]. 1: The timestamp points backward. For example, 2020-06-01 10:05 represents the interval [2020-06-01 10:00:00, 2020-06-01 10:04:59]. If omitted, the default value is 0. |
| query_area | string | No | Specifies the service area to query. all: Global cn: Mainland China abroad: Outside Mainland China Regions including Hong Kong, Macao, Taiwan, and other countries/regions: 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: Central Europe it: Italy ng: Nigeria gb: United Kingdom ir: Iran bh: Bahrain kw: Kuwait ca: Canada hk: Hong Kong, China mo: Macao, China tw: Taiwan, China If omitted, the default value is all. Region codes can be obtained through the Country and Region List API. |
| protocol_type | string | No | Specifies the HTTP protocol type to query. http: Query HTTP statistics https: Query HTTPS statistics If omitted, aggregated statistics for both HTTP and HTTPS are returned. |
| ip_protocol | string | No | Specifies the IP protocol type to query. ipv4: Query IPv4 statistics ipv6: Query IPv6 statistics If omitted, aggregated statistics for both IPv4 and IPv6 are returned. |
| query_region | string | No | Specifies aggregated query by service regions. Multiple regions can be separated by commas. A maximum of 10 regions are supported. Region codes can be obtained through the Country and Region List API. |
Request Example
# The request URL must be URL encoded.
curl -X GET "https://cdn.api.edgenext.com/v2/stat/bandwidth/eachDomain?token=xxx&\
domains=example.com,example2.com\
&start_time=2020-06-01%2012:16\
&end_time=2020-06-01%2012:30\
&query_area=cn"
Response Example
JSON format
Successful Response
{
"code": 0, // code is 0 when the response is successful.
"data": {
"example.com": {
"domain": "example.com",
"data": [
[
1590984900, // Timestamp, sorted in ascending order.
1988666.56 // Value of the metric specified by data_type.
],
[
1590985200,
3001901.81
],
...
]
},
"example2.com": {
"domain": "example2.com",
"data": [
[
1590984900,
1988666.56
],
[
1590985200,
3001901.81
],
...
]
}
}
}
Error Response
{
"code": 400101,
"message": "domain(life.com) is invalid"
}
Response Headers
Example:
HTTP/1.0 200 OK
Api-Id: 8335139
Content-Type: application/json; charset=utf-8
X-Ratelimit-Grad: minute // Rate limit granularity (minute/hour/day).
X-Ratelimit-Limit: 100 // Maximum number of requests allowed within the current rate limit period.
X-Ratelimit-Remaining: 99 // Remaining number of requests available within the current rate limit period.
X-Retry-After: 16 // Number of seconds until the current rate limit period is reset.
HTTP Status Code Description
| HTTP Status Code | Description |
|---|---|
| 404 | The requested URL is invalid. |
| 401 | Authentication failed. The token is invalid or the API permission has not been enabled. |
| 400 | Invalid request parameters. |
| 200 | Request completed successfully and the requested data is returned. |
| 5xx | Server-side error. Please contact the on-call support team. |
Need help? Contact our support team at support@edgenext.com.
Back to documentation home