文档中心 API文档 查询多域名的文件类型的流量及请求数

查询多域名的文件类型的流量及请求数

更新时间:2023-05-09 19:21:36

适用产品

网页加速、下载分发、动态加速、全站加速、点播分发、直播分发、上传加速、移动加速、S-P2P、PCDN、应用性能管理、WEB应用防火墙、BotGuard爬虫管理、WSS、DMS、DDoS云清洗、应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案

接口描述

获取账号下多个域名在指定时间段内的文件类型的流量及请求数统计。

请求参数

Body 参数

JSON
参数名称描述
datefromString
开始时间 1.格式为yyyy-MM-ddTHH:mm:ss+08:00; 2.必须小于当前时间和dateTo; 3.datefrom和dateTo相差不能超过7天;4.只能查询最近2年内数据。
datetoString
结束时间 1.格式为yyyy-MM-ddTHH:mm:ss+08:00; 2.必须大于datefrom;
orderbyString
排序 1.可选值为flow、hit; 2.不传默认为flow; 3.值为flow时查询结果按流量降序排列,值为hit时按请求数降序排列
请求体Array
域名列表 1.需满足域名正则校验; 2.不传递则查询全部域名; 3.域名个数限制根据账号可调,默认为20个;

返回参数

Body 参数

JSON
参数名称描述
domainString
域名
dateString
时间,格式为yyyy-MM-dd
filetypeString
文件类型
flowNumber
流量,保留2位小数,单位MB
hitNumber
请求数

错误码

错误代码(code)描述(message)HTTP状态码语义
InvalidHTTPRequestThere   was an error in the body of your HTTP request.400请求体格式错误
InvalidDatePeriodThe   date specified is invalid.400datefrom和dateto不符合规范
DateSpanErrorYou   cannot specify a period greater than 7.400datefrom和dateto相差超过7天
NoSuchDomainThe   specified domain does not exist.404参数domain不存在或不属于当前调用账号
DomainsExcessiveThe   number of domain is excessive once.403传递的域名个数超过账号限制
DomainNameIsRequiredThe   domain name is required.400参数体为空json数组
PARAM_INVALIDparam:   orderby is null or invalid.400参数orderby不符合规范
InternalErrorWe   encountered an internal error. Please try again.500系统发生错误

示例

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://open.chinanetcenter.com/api/report/filetype?datefrom=2017-11-01T00:00:00%2B08:00&dateto=2017-11-02T00:00:00%2B08:00&orderby=flow" \
-X "POST" \
-H "X-Time-Zone:GMT+08:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '[
    "test.com"
]'
返回示例
复制代码 复制成功
{
      "result":[
          {
                "domain":"test.com",
              "details":[
                  {
                        "date":"2017-01-01",
                        "filetypeDetail":[
                          {
                              "filetype":"/",
                                "flow":2201009.09,
                                "hit":2201009
                          },
                          {
                                "filetype":"txt",
                                "flow":2201005.05,
                                "hit":2201005
                          }
                      ]
                  },
                  {
                        "date":"2017-01-02",
                        "filetypeDetail":[
                          {
                              "filetype":"jpg",
                                "flow":2202009.09,
                                "hit":2202009
                          },
                          {
                                "filetype":"txt",
                                "flow":2202005.05,
                                "hit":2202005
                          }
                      ]
                  }
              ]
          }
      ]
  }
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!