GetCdnRelayTraffic

Update time: 2026-04-02 14:09:54

This API is used to query cdn relay traffic data for specified dimensions. Users can use this API to query detailed channel relay traffic reports for the corresponding customer, including output date, peak time, bandwidth peak, total traffic, etc. This is very helpful for customers to gain a direct understanding of their own relay traffic usage.

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

Request

Body Params

NameDescription
dateFromString

Start Time

  1. The time format is 'yyyy-MM-dd'.
  2. Cannot exceed the current date.
  3. Up to the past 730 days of data can be obtained.
dateToString

End time

  1. The time format is 'yyyy-MM-dd'.
  2. The end time must be greater than the start time.
  3. If the end time greater than the current time, the current time is taken.
  4. DateFrom and dateTo are both not provided, defaulting to query the current time; if only one is not provided, throw an exception.
  5. Maximum query interval allowed: 30 days, that is the range between dateFrom and dateTo can not exceed 30 days.
timezoneString
  1. Specify the time zone for both the query time range(dateFrom/dateTo) and the returned data.
  2. Greenwich Mean Time Zone, the default time zone is GMT+08:00.
  3. If you wish to specify a different time zone, you can append a time zone identifier, i.e. 'GMT+09:00' or 'GMT-10:00'.
timeRoundingString
Default value: up
Optional Value: updown

Rounds up or down a timestamp by a given time period. Only valid when the granularity is less than 1d(not including 1day)

  1. 'up' denotes rounds up, eg: granularity=5m then 00:00:00 ~ 00:05:00 will be displayed as 00:05:00.
  2. 'down' denotes rounds down, eg: granularity=5m then 00:00:00 ~ 00:05:00 will be displayed as 00:00:00.
  3. if not specified, the result will be rounded up.
domainString

Domains

  1. Domain is not uploaded: Query all domain names of the account (More than 2000 domains will encounter error, you can contact technical support for adjustment).
  2. Domain is uploaded: Up to 2000 domains are supported (you can contact technical support for adjustment).
  3. For multiple domain, please separate them with a semicolon ';'.
serviceTypeString

Service type of the acceleration domain

  1. If not specified, it is considered as 'no restriction on service type.
  2. For multiple Application server types, please separate them with a semicolon ';'. eg: 'web,web-https'
billingRegionString
Optional Value: Parameter Values

billing region of the Acceleration domain

  1. If not specified, it is considered as 'no restriction on billing region.
  2. For multiple billing regions, please separate them with a semicolon ';'. eg: 'cn;kr'
granularityString
Default value: 1d
Optional Value: 5m1h1d

time granularity: the default granularity is one day.

  • 5m: five minutes
  • 1h: one hour
  • 1d: one day
groupByString
Optional Value: domain

Group keywords

  1. If not specified, result will be aggregated as default.
  2. Passing in a keyword means that the details need to be displayed according to the values corresponding to the keyword dimension grouping (for example, passing in 'domain' means that the details are expanded according to domain). If an invalid value is specified, it will encounter an error.
  3. Support passing multiple values, for multiple value please separate them with a semicolon ';', only support 'domain' grouping currently.

Response

Body Params

NameDescription
codeString

request status code

messageString

request status description

dataObject

response data

reportObject

container for data information.

typeString
Default value: cdn-traffic-report-data

The metric name

dateFromString

Indicates the starting time of response data. The time format is yyyy-MM-dd. 

dateToString

Indicates the ending time of response data. The time format is yyyy-MM-dd. 

timezoneString
Default value: GMT+08:00

Indicates the time zone for the returned data. Greenwich Mean Time Zone, the format is GMT+08:00

groupsList

List of data items. Each item contains fields as following: 'domain', 'flow', 'peakBandwidth', 'peakTime' 

domainString

the name of domain

totalRelayTrafficString

Indicates the CDN-to-Client traffic volume in gigabytes. The value is accurate to 3 decimal places.

peakBandwidthString

Indicates the peak bandwidth(5-minute granularity) of CDN-to-Client traffic volume in Mbps. 1.The value is accurate to 3 decimal places. 2.If granularity<=5m, no display in groups container objects

peakTimeString

Indicates the time of peak bandwidth(5-minute granularity). 

itemList

List of data items.Each item contains fields as following: 'time', 'flow'

timeString

Indicates the date and time 1. If the type is "5m", the timestamp format is "YYYY-MM-DD hh:mm:00", that means the period's end time. 2. If the type is "1h", the timestamp format is "YYYY-MM-DD hh:00:00", that means the period's start time. 3. If the type is "1d", the timestamp format is "YYYY-MM-DD 00:00:00", that means the period's start time.

relayTrafficString

Indicates the CDN-to-Client traffic volume in gigabytes. The value is accurate to 3 decimal places.

Error code

Error code(code)Description(message)HTTP statusSemantic
24001121

Parameter not provided

200Parameter not provided
24001122

The format of parameter is incorrect

200The format of parameter is incorrect
24001123

The range of parameter is incorrect.

200The range of parameter is incorrect.
24001124

Parameter authentication failed

200Parameter authentication failed
24001125

Parameter data exceeds the limit

200Parameter data exceeds the limit
24001126

domain does not exist

200domain does not exist
24001127

domain is invalid

200domain is invalid
24001128

Billing region is invalid

200Billing region is invalid
24001129

The value of parameter is wrong

200The value of parameter is wrong
24001130

The given customer does not exist

200The given customer does not exist
24002001

Mysql querying encounter error

200Mysql querying encounter error

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://endpoint/cdn/traffic/relay" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/xml" \
-d '{"dateFrom":"2024-09-01","dateTo":"2024-09-01","domain":"a.com;b.com"}'
Response example
Copy Copy success
{
    "code": "0",
    "message": "Success",
    "data": {
        "report": {
            "type": "get-cdn-relay-traffic",
            "dateFrom": "2024-09-01",
            "dateTo": "2024-09-01",
            "timezone": "GMT+07:00",
            "groups": [
                {
                    "domain": "a.com",
                    "totalRelayTraffic": "0.053",
                    "peakBandwidth": "0.246",
                    "peakTime": "2024-09-01 01:05:00",
                    "item": [
                        {
                            "time": "2024-09-01 01:00:00",
                            "relayTraffic": "0.000"
                        },
                        {
                            "time": "2024-09-01 01:05:00",
                            "relayTraffic": "0.009"
                        },
                        {
                            "time": "2024-09-01 01:10:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:15:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:20:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:25:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:30:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:35:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:40:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:45:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:50:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:55:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 02:00:00",
                            "relayTraffic": "0.004"
                        }
                    ]
                },
                {
                    "domain": "b.com",
                    "totalRelayTraffic": "0.053",
                    "peakBandwidth": "0.246",
                    "peakTime": "2024-09-01 01:05:00",
                    "item": [
                        {
                            "time": "2024-09-01 01:00:00",
                            "relayTraffic": "0.000"
                        },
                        {
                            "time": "2024-09-01 01:05:00",
                            "relayTraffic": "0.009"
                        },
                        {
                            "time": "2024-09-01 01:10:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:15:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:20:00",
                            "relayTraffic": "0.005"
                        },
                        {
                            "time": "2024-09-01 01:25:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:30:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:35:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:40:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 01:45:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:50:00",
                            "relayTraffic": "0.003"
                        },
                        {
                            "time": "2024-09-01 01:55:00",
                            "relayTraffic": "0.004"
                        },
                        {
                            "time": "2024-09-01 02:00:00",
                            "relayTraffic": "0.004"
                        }
                    ]
                }
            ]
        }
    }
}
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!