Documentation API Docs Flow Report GetTrafficAndBandwidthByClientCountry

GetTrafficAndBandwidthByClientCountry

Update time: 2026-09-04 15:35:13

Applicable Products

Content Acceleration,Dynamic Web Acceleration,Media Acceleration VoD,Media Acceleration Live Broadcast

API Description

Query the traffic bandwidth distribution of a domain across countries and regions. Users input a time range and domain list to view data by domain, country, or domestic vs. foreign. Results include total regional traffic, its percentage, and traffic and bandwidth per time segment, aiding in global website traffic analysis and management. Query data from 24 hours prior is recommended.

Call frequency

Single user trigger frequency: 30/5min

Request parameter(s)

Body Params

NameDescription
dateFromString
Starting 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. Cannot be greater than the current time 3. Get up to the last six months (183 days) of data.
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 needs to be greater than the start time. If the end time is greater than the current time, the current time is taken. 3. dateFrom, dateTo are not passed, the default query for the past 24 hours; if there is only one untransmitted, throw an exception 4. Allow query maximum time interval: 7 days, that is, the difference between dateFrom and dateTo can’t exceed 7 days (can contact technical support adjustment, up to 31 days).
granularityString
Data granularity: 1.Support 5m (5 minutes granularity),1d (1 day granularity) 2.Do not pass the default to 5m
*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 code: 1. If not specified, all countries and regions will be queried by default 2. Support language request header Accept-Language, only supports zh-CN and en-US, the default is zh-CN. When Accept-Language is en-US, the country and region returned are all in English, otherwise they are returned in Chinese. Parameter Values
groupByList
Grouping dimension: 1.Can pass in single or multiple values. The aggregatedOversea and country cannot be passed at the same time; 2.If there is an incoming, the detailed data will be displayed according to the dimension: domain: Group display by domain name dimension; country: Group display by country dimension; aggregatedOversea: Group display according to domestic and overseas dimensions. 3.The result hierarchy is fixed in order, and the order of the parameters does not affect the order of the returned results. For example: 'groupBy': ['domain','country'] and 'groupBy': ['country','domain'] return the same result.

Response parameter(s)

Body Params

NameDescription
resultList
Result
domainString
Domain
countryDataList
countryCodeString
Country code
countryNameString
Country name
totalTrafficString
Summary of traffic in national regions: Summary of traffic flow in a single country region during the query period, unit of measure MB, retain two decimals
trafficPercentageString
National regional traffic ratio: the proportion (percentage) of traffic value in a single country region during the query period, retain two decimals
dataSeriesList
timestampString
1. When the data size of the query is 5m, the format is yyyy-MM-dd HH:mm; each time slice data value represents the data value in the previous time granularity range. The time slice starting at the beginning of the day is yyyy-MM-dd 00:05, and the last time slice is (yyyy-MM-dd+1) 00:00. 2. Returns the time slice contained in the start time and end time.
trafficString
Traffic value: Unit: MB, retain two decimals
bandwidthString
Bandwidth value. Unit: Mbps , retain two decimals

Error code

Error code(code)Description(message)HTTP statusSemantic
MissingBodyRequest body has not specified400Request body has not specified
NotAcceptableAccept as request header is not supported, as interface only supports json and xml formats, with json as the default format400Accept as request header is not supported, as interface only supports json and xml formats, with json as the default format
InvalidHTTPRequestIncorrect format of request body400Incorrect format of request body
InvalidDatePerioddatafrom or dateto not compliant to specifications400datafrom or dateto not compliant to specifications
DateSpanErrorPeriod between datafrom and dateto is longer than 7 days400Period between datafrom and dateto is longer than 7 days
NumberLimitExceededNumber of queried domains exceeds   limits set to the account400Number of queried domains exceeds   limits set to the account
PARAM_INVALIDParameter of groupBy not compliant to specifications400Parameter of groupBy not compliant to specifications
InternalErrorSystem has encountered an error500System has encountered an error
PARAM_INVALIDparam: domain is null or invalid.400param: domain is null or invalid.
PARAM_INVALIDparam: countryCode is null or invalid.400param: countryCode is null or invalid.
MissingBodyRequest body has not specified400Request body has not specified
NotAcceptableAccept as request header is not supported, as interface only supports json and xml formats, with json as the default format400Accept as request header is not supported, as interface only supports json and xml formats, with json as the default format
InvalidHTTPRequestIncorrect format of request body400Incorrect format of request body
InvalidDatePerioddatafrom or dateto not compliant to specifications400datafrom or dateto not compliant to specifications
DateSpanErrorPeriod between datafrom and dateto is longer than 7 days400Period between datafrom and dateto is longer than 7 days
NumberLimitExceededNumber of queried domains exceeds   limits set to the account400Number of queried domains exceeds   limits set to the account
PARAM_INVALIDParameter of groupBy not compliant to specifications400Parameter of groupBy not compliant to specifications
InternalErrorSystem has encountered an error500System has encountered an error
PARAM_INVALIDparam: domain is null or invalid.400param: domain is null or invalid.
PARAM_INVALIDparam: countryCode is null or invalid.400param: countryCode is null or invalid.

Example

JSON(GROUPBY COUNTRY)
JSON(GROUPBY AGGREGATEDOVERSEA)
JSON(GROUPBY COUNTRY)
Request example
Copy Copy success
#!/bin/bash
# Please remember to change the param (-H "X-Time-Zone") in this demo to the TimeZone you want in response

  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.atomile.com/api/report/traffic/domain-country" \
  -X "POST" \
  -H "X-Time-Zone:GMT+00:00" \
  -H "Accept-Language: en-US" \
  -u "$username:$password" \
  -H "Date: $date" \
  -H "Accept: application/json" \
  -d '{
      "dateFrom":   "2018-04-19T00:00:00+00:00",
      "dateTo":   "2018-04-20T00:00:00+00:00",
      "domain": [
          "www.test1.com",
        "www.test2.com"
      ],
      "granularity":   "5m",
      "countryCode": [
          "cn",
          "jp"
      ],
      "groupBy": [
          "domain",
          "country"
      ]
  }'
Response example
Copy Copy success
{
      "result":[
          {
              "domain":"www.test1.com",
              "countryData":[
                  {
                        "countryCode":"jp",
                        "countryName":"Japan",
                        "totalTraffic":"2.00",
                        "trafficPercentage":"16.67%",
                        "dataSeries":[
                          {
                                "timestamp":"2018-04-19 00:10",
                                "traffic":"2.00",
                                "bandwidth":"1.00"
                          }
                      ]
                  },
                  {
                        "countryCode":"cn",
                        "countryName":"China",
                        "totalTraffic":"10.00",
                        "trafficPercentage":"83.33%",
                        "dataSeries":[
                          {
                                "timestamp":"2018-04-19 00:05",
                                "traffic":"1.00",
                                "bandwidth":"1.00"
                          },
                          {
                                "timestamp":"2018-04-19 00:10",
                                "traffic":"2.00",
                                "bandwidth":"1.00"
                          }
                      ]
                  }
              ]
          },
          {
              "domain":"www,test2,com",
              "countryData":[
                  {
                        "countryCode":"cn",
                        "countryName":"China",
                        "totalTraffic":"1.00",
                        "trafficPercentage":"100.00%",
                        "dataSeries":[
                          {
                                "timestamp":"2018-04-19 00:05",
                                "value":"1.00"
                          }
                      ]
                  }
              ]
          }
      ]
  }