This API is used to query the Traffic data of multiple domain under the specified transmission protocol. The query is for the data of all Edge node. The user needs to specify the domain, start and end time, transmission protocol and other parameters, and can select the data granularity and grouping dimension. By default, the query will return the Traffic data of the HTTPS protocol, and the output result is the Traffic value of each domain at different time points. This interface is suitable for scenarios where you need to query and analyze the Traffic of multiple domain with different transmission protocols.
파라미터 이름 | 설명 |
---|---|
dateFromString | Start time:
1.The format is yyyy-MM-ddTHH:mm:ss+08:00;
2.Must be a time that is 183 days earlier than the current time, and the time must be earlier than the current time and dateTo;
3.Period between dataFrom and dateTo cannot be longer than 7 days(technical support can be contacted to adjust);
4.dateFrom and dateTo can be either both are specified or neither is specifies;
5.If neither dateFrom nor dateTo is specified, then by default, data in the last 24 hour is queried |
dateToString | End time:
1.The format is yyyy-MM-ddTHH:mm:ss+08:00;
2.Must be greater than dateFrom;
3.If it's greater than the current time, then the current time is assigned as the value; |
*domainList | Domain names, domain number limits can be adjusted depending on different accounts. The default value is 20 |
dataIntervalString | Data granularity:
Support for 1m(1 minutes), 5m (5 minutes), 1h (1 hour), 1d (1 day) |
protocolTypeString | Transmission protocol:
1.Options: http, https;
2.https is used as the default value is no value specified;
3.httpFlowData is displayed if http is queried, and httpsFlowData is displayed if https is queried; |
groupByList | Group dimension:
1.The value can be selected is domain;
2.The data is displayed according to the specified dimension; |
파라미터 이름 | 설명 |
---|---|
resultList | result |
domainString | Domain |
httpsFlowDataList | |
timestampString | DateTime: the format is yyyy-MM-dd HH:mm; the data value of every time slice represents the data value within the previous time granularity range. The first time slice of the day is yyyy-MM-dd 12:05 AM, and the last one is (yyyy-MM-dd+1) 00:00. |
valueString | Traffic unit is MB and 2 digits of decimals allowed |
에러 코드(code) | 설명(message) | HTTP 상태 코드 | 설명 |
---|---|---|---|
NotAcceptable | The accept header specified in your request is not acceptable. | 400 | Accept as request header is not supported, as interface only supports json and xml formats, with json as the default format |
MissingBody | This operation requires a body. Ensure that the body is present and the Content-Type header is set. | 400 | Request body has not specified |
InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 | Incorrect format of request body |
InvalidDatePeriod | The date specified is invalid. | 400 | dataFrom or dateTo not compliant to specifications |
DateSpanError | You cannot specify a period greater than 7. | 400 | Period between dataFrom and dateTo is longer than 7 days |
NumberLimitExceeded | The request was rejected because the number of domain({actual}) exceeds the limit ({expect}). | 400 | Number of queried domains exceeds limits set to the account |
PARAM_INVALID | param: groupBy is null or invalid. | 400 | Parameter groupBy not compliant to specifications |
InternalError | We encountered an internal error. Please try again. | 500 | System has encountered an error |
PARAM_INVALID | param: domain is null or invalid. | 400 | Parameter domain does not comply with the specification |
PARAM_INVALID | param: dataInterval is null or invalid. | 400 | Parameter dataInterval does not comply with the specification |
PARAM_INVALID | param: protocolType is null or invalid. | 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/flow/protocol" \ -X "POST" \ -H "X-Time-Zone:GMT+08:00" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{ "dateFrom":"2017-07-05T00:00:00+08:00", "dateTo":"2017-07-05T23:00:00+08:00", "domain":[ "test.com" ], "dataInterval":"5m", "protocolType":"https", "groupBy":[ "domain" ] }'
{ "result":[ { "domain":"test.com", "httpsFlowData":[ { "timestamp":"2017-07-05 00:00", "value":"0.00" }, { "timestamp":"2017-07-05 00:05", "value":"0.00" } ] } ] }