API中心

查询多域名的指定传输协议的流量

更新时间:2026-07-13 15:49:30

该接口用于查询多个域名在指定传输协议下的流量数据,查询的是所有边缘节点的数据。用户需指定域名、起止时间、传输协议等参数,并可选择数据粒度和分组维度。默认情况下,查询会返回HTTPS协议的流量数据,输出结果为每个域名在不同时间点的流量值。此接口适用于需要查询和分析多域名不同传输协议流量的场景。

  • 数据延迟:5~15min
  • 单用户调用频率:300/5min
  • 适用产品:静态加速、Bot管理、动态加速、DDoS云清洗、互动直播、Web应用防火墙、流媒体点播、流媒体直播、DDoS云清洗 2.0
API鉴权说明详见:API鉴权概览

请求参数

Body 参数

参数名称描述
dateFromString

开始时间 1.时间格式为 yyyy-MM-ddTHH:mm:ss±HH:mm。请注意:±HH:mm 为时区偏移量,可根据您的数据需要进行调整,例如 +00:00 代表 UTC 时间,+08:00 代表东八区,-05:00 代表西五区。2024-01-15T10:30:45+00:00,表示UTC 时间 2024 年 1 月 15 日上午 10 点 30 分 45 秒; 2.必须大于当前时间-183天,并且小于当前时间和dateTo; 3.dateFrom和dateTo相差不能超过7天(可联系技术支持调整); 4.dateFrom和dateTo要么都传递,要么都不传递; 5.dateFrom和dateTo都未传递,则默认查询过去24小时的数据

dateToString

结束时间 1.时间格式为 yyyy-MM-ddTHH:mm:ss±HH:mm。请注意:±HH:mm 为时区偏移量,可根据您的数据需要进行调整,例如 +00:00 代表 UTC 时间,+08:00 代表东八区,-05:00 代表西五区。2024-01-15T10:30:45+00:00,表示UTC 时间 2024 年 1 月 15 日上午 10 点 30 分 45 秒; 2.必须大于dateFrom; 3.如果大于当前时间,则重新赋值为当前时间;

*domainList

域名,域名个数限制根据账号可调,默认为20个

granularityString
默认值:5m
可选值:1m5m1h1d

数据粒度: 1m:1分钟粒度 5m:5分钟粒度 1h:1小时粒度 1d:1天粒度

protocolTypeString
默认值:https
可选值:httphttps

传输协议 1.可选值为http、https; 2.不传默认查询https; 3.查询http时出参展示httpFlowData,查询https时出参展示httpsFlowData;

groupByList
可选值:domain

分组维度 1.可选值为domain; 2.有传入则按照该维度展示明细数据;

返回参数

Body 参数

参数名称描述
resultList

结果

domainString

域名

dataSeriesList

时间序列数据列表

timestampString

时间,格式为yyyy-MM-dd HH:mm;每一个时间片数据值代表的是前一个时间粒度范围内的数据值。一天开始的时间片是yyyy-MM-dd 00:05,最后一个时间片是(yyyy-MM-dd+1)00:00。

trafficString

流量值:

单位MB,保留2位小数

错误码

错误代码(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

400Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
MissingBody

Request body has not specified

400请求体没有传递
InvalidHTTPRequest

Incorrect format of request body

400请求体格式错误
InvalidDatePeriod

dataFrom or dateTo not compliant   to specifications

400dateFrom或dateTo不符合规范
DateSpanError

Period between dataFrom and   dateTo is longer than 7 days

400dateFrom和dateTo相差超过7天
NumberLimitExceeded

Number of queried domains exceeds   limits set to the account

400传递的域名个数超过账号限制
PARAM_INVALID

Parameter groupBy not compliant   to specifications

400参数groupBy不符合规范
InternalError

System has encountered an error

500系统发生错误
PARAM_INVALID

Parameter domain does not comply with the specification

400参数domain不符合规范
PARAM_INVALID

Parameter granularity does not comply with the specification

400参数granularity不符合规范
PARAM_INVALID

Parameter protocolType does not comply with the specification

400参数protocolType不符合规范

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/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"
                  }
              ]
          }
      ]
  }
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!