网页加速、下载分发、动态加速、全站加速、点播分发、直播分发、上传加速、移动加速、S-P2P、PCDN、应用性能管理、WEB应用防火墙、BotGuard爬虫管理、WSS、DMS、DDoS云清洗、应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案
获取账号下多个域名在指定时间段内的文件类型的流量及请求数统计。
参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|
datefrom | String | 否 | 开始时间 1.格式为yyyy-MM-ddTHH:mm:ss+08:00; 2.必须小于当前时间和dateTo; 3.datefrom和dateTo相差不能超过7天;4.只能查询最近2年内数据。 |
dateto | String | 否 | 结束时间 1.格式为yyyy-MM-ddTHH:mm:ss+08:00; 2.必须大于datefrom; |
orderby | String | 否 | 排序 1.可选值为flow、hit; 2.不传默认为flow; 3.值为flow时查询结果按流量降序排列,值为hit时按请求数降序排列 |
请求体 | Array | 否 | 域名列表 1.需满足域名正则校验; 2.不传递则查询全部域名; 3.域名个数限制根据账号可调,默认为20个; |
参数名称 | 类型 | 描述 |
---|---|---|
domain | String | 域名 |
date | String | 时间,格式为yyyy-MM-dd |
filetype | String | 文件类型 |
flow | Number | 流量,保留2位小数,单位MB |
hit | Number | 请求数 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 | 请求体格式错误 |
InvalidDatePeriod | The date specified is invalid. | 400 | datefrom和dateto不符合规范 |
DateSpanError | You cannot specify a period greater than 7. | 400 | datefrom和dateto相差超过7天 |
NoSuchDomain | The specified domain does not exist. | 404 | 参数domain不存在或不属于当前调用账号 |
DomainsExcessive | The number of domain is excessive once. | 403 | 传递的域名个数超过账号限制 |
DomainNameIsRequired | The domain name is required. | 400 | 参数体为空json数组 |
PARAM_INVALID | param: orderby is null or invalid. | 400 | 参数orderby不符合规范 |
InternalError | We encountered an internal error. Please try again. | 500 | 系统发生错误 |
#!/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 } ] } ] } ] }