Web Application Firewall

GetTrafficByProtocol

Update time: 2025-10-30 19:45:11

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.

  • Data latency: 5~15min
  • Limit of request rate per user: 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
For API authentication details, please refer to: API Authentication Overview

Request

Body Params

NameDescription
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
Default value: 5m
Optional Value: 1m5m1h1d
**Data granularity** 1m: 1minute 5m: 5minutes 1h: 1hour 1d: 1day
protocolTypeString
Default value: https
Optional Value: 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
Optional Value: domain
Group dimension: 1.Only 'domain' is a valid value. 2.If provided, detailed data will be displayed according to this dimension.

Response

Body Params

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

Error code

Error code(code)Description(message)HTTP statusSemantic
NotAcceptableAccept as request header is not   supported, as interface only supports json and xml formats, with json as the   default format400Accept as request header is not   supported, as interface only supports json and xml formats, with json as the   default format
MissingBodyRequest body has not specified400Request body has not specified
InvalidHTTPRequestIncorrect format of request body400Incorrect format of request body
InvalidDatePerioddataFrom or dateTo not compliant   to specifications400dataFrom or dateTo not compliant   to specifications
DateSpanErrorPeriod between dataFrom and   dateTo is longer than 7 days400Period between dataFrom and   dateTo is longer than 7 days
NumberLimitExceededNumber of queried domains exceeds   limits set to the account400Number of queried domains exceeds   limits set to the account
PARAM_INVALIDParameter groupBy not compliant   to specifications400Parameter groupBy not compliant   to specifications
InternalErrorSystem has encountered an error500System has encountered an error
PARAM_INVALIDParameter domain does not comply with the specification400Parameter domain does not comply with the specification
PARAM_INVALIDParameter granularity does not comply with the specification400Parameter granularity does not comply with the specification
PARAM_INVALIDParameter protocolType does not comply with the specification400Parameter protocolType does not comply with the specification

Example

JSON
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/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"
    ]
}'
Response example
Copy Copy success
{
      "result":[
          {
              "domain":"test.com",
              "dataSeries":[
                  {
                      "timestamp":"2017-07-05 00:00",
                      "traffic":"1.20"
                  },
                  {
                       "timestamp":"2017-07-05 00:05",
                       "traffic":"12.37"
                  }
              ]
          }
      ]
  }
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!