This API is used to query traffic data for multiple domains under a specified transmission protocol, covering data from all edge nodes. Users must specify parameters such as domain, start and end time, and transmission protocol, and can select data granularity and grouping dimensions. By default, the query returns HTTPS protocol traffic data, with output showing traffic values for each domain at different time points. This interface is suitable for scenarios requiring the query and analysis of multi-domain traffic across various transmission protocols.
| 파라미터 이름 | 설명 |
|---|---|
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.Must be no more than 183 days prior to the current time, and must be earlier than both the current time and `dateTo`.
3.The period between `dateFrom` and `dateTo` cannot exceed 7 days (contact technical support for adjustments).
4.Either both `dateFrom` and `dateTo` must be specified, or neither should be specified.
5.If neither dateFrom nor dateTo is specified, then by default, data for the last 24 hours is queried. |
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.Must be greater than dateFrom.
3.If it is greater than the current time, it will be reset to the current time. |
*domainList | Domain names. The number of allowed domains can be adjusted based on the account type, with a default limit of 20. |
granularityString | 기본값: 5m 선택 가능한 값:1m5m1h1d **Data granularity**
1m: 1minute
5m: 5minutes
1h: 1hour
1d: 1day |
protocolTypeString | 기본값: https 선택 가능한 값:httphttps Transmission protocol:
1.Options: http, https.
2.If no value is specified, https is used as the default.
3.If http is queried, `httpFlowData` is displayed in the response; if https is queried, `httpsFlowData` is displayed. |
groupByList | 선택 가능한 값:domain Group dimension:
1.Only 'domain' is a valid value.
2.If provided, detailed data will be displayed according to this dimension. |
| 파라미터 이름 | 설명 |
|---|---|
resultList | The query result set. |
domainString | The domain name. |
dataSeriesList | Time-series data list. |
timestampString | Timestamp, in yyyy-MM-dd HH:mm format. Each timestamp's data value represents the aggregated data within the preceding time granularity interval. The first timestamp for a day is yyyy-MM-dd 00:05, and the last is (yyyy-MM-dd+1) 00:00. |
trafficString | Traffic value:
Unit: MB. Retains two decimal places. |
| 에러 코드(code) | 설명(message) | HTTP 상태 코드 | 설명 |
|---|---|---|---|
| NotAcceptable | Accept as request header is not supported, as interface only supports json and xml formats, with json as the default format | 400 | Accept as request header is not supported, as interface only supports json and xml formats, with json as the default format |
| MissingBody | Request body has not specified | 400 | Request body has not specified |
| InvalidHTTPRequest | Incorrect format of request body | 400 | Incorrect format of request body |
| InvalidDatePeriod | dataFrom or dateTo not compliant to specifications | 400 | dataFrom or dateTo not compliant to specifications |
| DateSpanError | Period between dataFrom and dateTo is longer than 7 days | 400 | Period between dataFrom and dateTo is longer than 7 days |
| NumberLimitExceeded | Number of queried domains exceeds limits set to the account | 400 | Number of queried domains exceeds limits set to the account |
| PARAM_INVALID | Parameter groupBy not compliant to specifications | 400 | Parameter groupBy not compliant to specifications |
| InternalError | System has encountered an error | 500 | System has encountered an error |
| PARAM_INVALID | Parameter domain does not comply with the specification | 400 | Parameter domain does not comply with the specification |
| PARAM_INVALID | Parameter granularity does not comply with the specification | 400 | Parameter granularity does not comply with the specification |
| PARAM_INVALID | Parameter protocolType does not comply with the specification | 400 | Parameter protocolType does not comply with the specification |
#!/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.cdnetworks.com/api/report/traffic/protocol" \
-X "POST" \
-H "X-Time-Zone:GMT+00:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{
"dateFrom":"2017-07-05T00:00:00+00:00",
"dateTo":"2017-07-05T23:00:00+00:00",
"domain":[
"test.com"
],
"granularity":"5m",
"protocolType":"https",
"groupBy":[
"domain"
]
}'{
"result":[
{
"domain":"test.com",
"dataSeries":[
{
"timestamp":"2017-07-05 00:00",
"traffic":"1.20"
},
{
"timestamp":"2017-07-05 00:05",
"traffic":"12.37"
}
]
}
]
}