QueryTrafficBySpecificProtocol

Update time: 2024-04-17 15:01:54

Query the traffic with a specific protocol for multiple domains, and the traffic statistics contain data of all edge nodes. Around 5-15 minutes of data delay. It's recommended that the call frequency is no higher than 30/5min.

  • Data latency: 5~15min
  • Single user trigger frequency: 300/5min
  • Applicable Products: Content Acceleration,Bot Shield,Dynamic Web Acceleration,Flood Shield,Media Acceleration Live Broadcast,Web Application Firewall,Media Acceleration,Media Acceleration-Live,Flood Shield 2.0

Request

Body Params

NameDescription
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;

Response

Body Params

NameDescription
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

Error code

Error code(code)Description(message)HTTP statusSemantic
NotAcceptableThe   accept header specified in your request is not acceptable.400Accept as request header is not   supported, as interface only supports json and xml formats, with json as the   default format
MissingBodyThis   operation requires a body. Ensure that the body is present and the   Content-Type header is set.400Request body has not specified
InvalidHTTPRequestThere   was an error in the body of your HTTP request.400Incorrect format of request body
InvalidDatePeriodThe   date specified is invalid.400dataFrom or dateTo not compliant   to specifications
DateSpanErrorYou   cannot specify a period greater than 7.400Period between dataFrom and   dateTo is longer than 7 days
NumberLimitExceededThe   request was rejected because the number of domain({actual}) exceeds the limit   ({expect}).400Number of queried domains exceeds   limits set to the account
PARAM_INVALIDparam:   groupBy is null or invalid.400Parameter groupBy not compliant   to specifications
InternalErrorWe   encountered an internal error. Please try again.500System has encountered an error
PARAM_INVALIDparam: domain is null or invalid.400Parameter domain does not comply with the specification
PARAM_INVALIDparam: dataInterval is null or invalid.400Parameter dataInterval does not comply with the specification
PARAM_INVALIDparam: protocolType is null or invalid.400Parameter protocolType does not comply with the specification

Example

JSON
XML
JSON
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.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"
    ]
}'
Response example
Copy Copy success
{
      "result":[
          {
                "domain":"test.com",
              "httpsFlowData":[
                  {
                        "timestamp":"2017-07-05 00:00",
                      "value":"0.00"
                  },
                  {
                        "timestamp":"2017-07-05 00:05",
                        "value":"0.00"
                  }
              ]
          }
      ]
  }
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!