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.
| Name | Description |
|---|---|
dateFromString | Start Time
|
dateToString | End time
|
timezoneString |
|
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)
|
domainString | Domains
|
serviceTypeString | Service type of the acceleration domain
|
billingRegionString | Optional Value: Parameter Values billing region of the Acceleration domain
|
granularityString | Default value: 1d Optional Value: 5m1h1d time granularity: the default granularity is one day.
|
groupByString | Optional Value: domain Group keywords
|
| Name | Description |
|---|---|
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(code) | Description(message) | HTTP status | Semantic |
|---|---|---|---|
| 24001121 | Parameter not provided | 200 | Parameter not provided |
| 24001122 | The format of parameter is incorrect | 200 | The format of parameter is incorrect |
| 24001123 | The range of parameter is incorrect. | 200 | The range of parameter is incorrect. |
| 24001124 | Parameter authentication failed | 200 | Parameter authentication failed |
| 24001125 | Parameter data exceeds the limit | 200 | Parameter data exceeds the limit |
| 24001126 | domain does not exist | 200 | domain does not exist |
| 24001127 | domain is invalid | 200 | domain is invalid |
| 24001128 | Billing region is invalid | 200 | Billing region is invalid |
| 24001129 | The value of parameter is wrong | 200 | The value of parameter is wrong |
| 24001130 | The given customer does not exist | 200 | The given customer does not exist |
| 24002001 | Mysql querying encounter error | 200 | Mysql querying encounter error |
#!/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"}'{
"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"
}
]
}
]
}
}
}