Log Download

ReportCountryServerBandwidthService

Update time: 2025-05-19 13:53:37

This interface is used to query the bandwidth details of the country to which the server IP belongs. The user needs to provide the time range, domain name, country code, and data granularity. The return content includes the edge traffic and bandwidth values at each time point in the specified time period. This interface helps users understand the current service traffic distribution and usage in different countries around the world.

  • Limit of request rate per user: 300/5min
  • Applicable Products: Log Download,Dynamic Web Acceleration,Content Acceleration,Media Acceleration Live Broadcast,Flood Shield 2.0,Flood Shield,Media Acceleration,Low Latency Streaming,Web Application Firewall,Media Acceleration-Live
For API authentication details, please refer to: API Authentication Overview

Request

Body Params

NameDescription
dateFromString
Start time: 1. The time format is yyyy-MM-ddTHH:mm:ss±HH:mm. Please note: ±HH:mm is the time zone offset, which can be adjusted according to your data needs, for example, +00:00 represents UTC time, +08:00 represents East 8th District, and -05:00 represents West 5th District. 2024-01-15T10:30:45+00:00 means UTC time January 15, 2024 10:30:45 AM; 2. Can not exceed the current time; 3. The latest half year (183 days) data can be obtained at most.
dateToString
End time: 1.The time format is yyyy-MM-ddTHH:mm:ss±HH:mm. Please note: ±HH:mm is the time zone offset, which can be adjusted according to your data needs, for example, +00:00 represents UTC time, +08:00 represents East 8th District, and -05:00 represents West 5th District. 2024-01-15T10:30:45+00:00 means UTC time January 15, 2024 10:30:45 AM; 2. The end time is greater than the start time. 3. If the end time is greater than the current time, the current time is taken. 4. DateFrom and dateTo are not uploaded, defaulting to query the past 24 hours; if only one is not uploaded, throw an exception; 5. Maximum query interval allowed: 7 days, that is, the difference between dateFrom and dateTo can not exceed 7 days.
domainList
Domains: 1.Domain is not uploaded: Query all domain names of the account (More than 20 domains will error,you can contact technical support for adjustment); 2.Domain is uploaded: Up to 20 domains are supported(you can contact technical support for adjustment).
countryCodeList
Country area: 1. countryCode is not uploaded: Query all country areas by default; 2. countryCode is uploaded: Multiple can be uploaded, such as cn, in. Please refer to the appendix description section of the overview page.
dataIntervalString
Data granularity: 5m: 5 minute granularity; Default value is 5m. 1h: 1 hour granularity.

Response

Body Params

NameDescription
domainString
Domain
countryDataList
countryCodeString
Country area
detailListList
timestampString
Time: 1. When the data query granularity is 5m, then the format is yyyy-MM-dd HH:mm; ach time slice value represents the value within the previous time granularity range. The first time slice of the day is yyyy-MM-dd 00:05, and the last one is (yyyy-MM-dd+1) 00:00; 2. When the data query granularity is 1h, the format is yyyy-MM-dd HH; Each time slice value represents the value within the previous time granularity range. The first time slice of the day is yyyy-MM-dd 01, and the last one is (yyyy-MM-dd+1) 00; 3. Return the time slices that contained in start time and in end time.
valueString
Bandwidth value, unit Mbps
flowString
Flow, unit MB

Error code

Error code(code)Description(message)HTTP statusSemantic
24102019The request was rejected because the number of domain exceeds the limit.400The request was rejected because the number of domain exceeds the limit.
24102006The date specified is invalid.400The date specified is invalid.
24102021Date format error.400Date format error.
24102008domain is null or invalid.400param: domain is null or invalid.
24102500System error400We encountered an internal error. Please try again

Example

JSON
JSON
Request example
Copy Copy success
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/api/report/server/country-bandwidth" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{"dateFrom":"2022-07-22T00:00:00+00:00",
"dateTo":"2022-07-22T23:00:00+00:00",
"domain":["www.example1.com","www.example2.com"],
"countryCode":["hk"]
}'
Response example
Copy Copy success
{
  "code": "0",
  "message": "success",
  "data": [
    {
      "domain": "www.example1.com",
      "countryData": [
        {
          "countryCode": "hk",
          "detailList": [
            {
              "timestamp": "2022-07-22 14:00",
              "value": "0.52",
              "flow": "19.67"
            },
            {
              "timestamp": "2022-07-22 15:00",
              "value": "1.05",
              "flow": "39.54"
            },
            {
              "timestamp": "2022-07-22 16:00",
              "value": "0.54",
              "flow": "20.39"
            },
            {
              "timestamp": "2022-07-22 17:00",
              "value": "0.80",
              "flow": "29.99"
            }
          ]
        }
      ]
    },
    {
      "domain": "www.example2.com",
      "countryData": [
        {
          "countryCode": "hk",
          "detailList": [
            {
              "timestamp": "2022-07-22 14:00",
              "value": "0.66",
              "flow": "24.93"
            },
            {
              "timestamp": "2022-07-22 15:00",
              "value": "1.14",
              "flow": "42.76"
            },
            {
              "timestamp": "2022-07-22 16:00",
              "value": "0.94",
              "flow": "35.25"
            },
            {
              "timestamp": "2022-07-22 17:00",
              "value": "0.98",
              "flow": "36.81"
            }
          ]
        }
      ]
    }
  ]
}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!