全站加速、上传加速、PCDN、DMS、移动加速、应用安全解决方案、政企安全加速解决方案、IPv6一体化解决方案、下载分发、网页加速、WSS、WEB应用防火墙、应用安全加速解决方案、BotGuard爬虫管理、区块链安全加速解决方案、电商安全加速解决方案、动态加速、金融安全加速解决方案、IPv6安全加速解决方案、点播分发、DDoS云清洗
用于拉取短时间内的边缘节点的流量及请求数
单用户调用频率:2000/5min
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 描述 |
---|---|
dateFrom | 开始时间:
1.时间格式为yyyy-MM-ddTHH:mm:ss+08:00,例如,2016-12-02T10:00:00+08:00(为北京时间2016年12月2日10点0分0秒);
2.不能大于当前时间;
3.最多可获取最近半年(183天)的数据。 |
dateTo | 结束时间:
1.时间格式2016-12-02T10:00:00+08:00;
2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间;
3.dateFrom,dateTo二者都未传,默认查询过去的24小时,如仅有一个未传,抛异常;
4.允许查询最大时间间隔:1天,即dateFrom和dateTo相差不能超过1天(可联系技术支持调整,最大不超过31天)。 |
domain | 域名:
1.可传递域名数量上限默认200个(可联系技术支持调整,最高上限500);
2.未传递该入参时查询账号下所有域名,但当账号下域名数量超过限制时不可查询(报错)。 |
groupBy | 分组关键词:
1.默认聚合展示;
2.传入关键词则代表需要按照关键词对应的值展示明细;
例如groupBy传domain,则代表返回按照domain明细展开。
3.只能传递domain。 |
dataPadding | 是否补0:
取值为true或false,默认为false
当dataPadding取值为true时,没有数据的时间点填充数据,取值为0;
当dataPadding取值为false时,不做处理 |
参数名称 | 描述 |
---|---|
result | |
domain | 域名 |
totalFlow | 总流量,单位:MB ,保留2位小数,示例 ( 74099.92 ) |
totalRequest | 总请求数 |
peakBandwidth | 峰值带宽,单位: Mbps,保留2位小数,示例 (931556.21) |
peakTime | 峰值时间,示例(2019-02-13 18:01) |
peakRequest | 请求数峰值 |
peakRequestTime | 请求数峰值时间 |
flowRequestData | |
timestamp | 时间片
1.查询的数据粒度为5m时,格式为yyyy-MM-dd HH:mm;每一个时间片数据值代表的是前一个时间粒度范围内的数据值。一天开始的时间片是yyyy-MM-dd 00:05,最后一个时间片是(yyyy-MM-dd+1) 00:00;
2.返回开始时间和结束时间包含的时间片。 |
flow | 流量值,单位MB,保留2位小数; |
bandwidth | 带宽值,单位: Mbps,保留2位小数,示例 (931556.21) |
request | 请求数 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
MissingBody | This operation requires a body. Ensure that the body is present and the Content-Type header is set. | 400 | 请求体没有传递 |
NotAcceptable | The accept header specified in your request is not acceptable. | 400 | Accept请求头不支持,接口仅支持json和xml格式,默认为json格式 |
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 30. | 400 | dateFrom和dateTo相差超过30分钟 |
PARAM_INVALID | param: domain is null or invalid. | 400 | 参数domain不符合规范 |
NumberLimitExceeded | The request was rejected because the number of domain({actual}) exceeds the limit ({expect}) | 400 | 传递的域名个数超过账号限制 |
InternalError | We encountered an internal error. Please try again. | 500 | 系统发生错误 |
PARAM_INVALID | param: dataPadding is null or invalid. | 400 | dataPadding 不符合规范 |
#!/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/flow-request" \ -X "POST" \ -H "X-Time-Zone:GMT+08:00" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{ "dateFrom": "2020-09-06T00:00:00+08:00", "dateTo": "2020-09-06T01:00:00+08:00", "domain": ["www.aaa.com","www.bbb.com","www.ccc.com"], "groupBy": ["domain"], "dataPadding":true }'
{ "result": [ { "domain": "www.aaa.com", "totalFlow": "780.00", "totalRequest": "100", "peakBandwidth": "3.20", "peakRequest": "100", "peakRequestTime": "2020-09-06 00:05", "peakTime": "2020-09-06 01:00", "flowRequestData": [ { "timestamp": "2020-09-06 00:00", "bandwidth": "0.00", "flow": "0.00", "request": "0" }, { "timestamp": "2020-09-06 00:05", "bandwidth": "0.27", "flow": "10.00", "request": "100" }, { "timestamp": "2020-09-06 00:10", "bandwidth": "0.53", "flow": "20.00" }, { "timestamp": "2020-09-06 00:15", "bandwidth": "0.80", "flow": "30.00" }, { "timestamp": "2020-09-06 00:20", "bandwidth": "1.07", "flow": "40.00" }, { "timestamp": "2020-09-06 00:25", "bandwidth": "1.33", "flow": "50.00" }, { "timestamp": "2020-09-06 00:30", "bandwidth": "1.60", "flow": "60.00" }, { "timestamp": "2020-09-06 00:35", "bandwidth": "1.87", "flow": "70.00" }, { "timestamp": "2020-09-06 00:40", "bandwidth": "2.13", "flow": "80.00" }, { "timestamp": "2020-09-06 00:45", "bandwidth": "2.40", "flow": "90.00" }, { "timestamp": "2020-09-06 00:50", "bandwidth": "2.67", "flow": "100.00" }, { "timestamp": "2020-09-06 00:55", "bandwidth": "2.93", "flow": "110.00" }, { "timestamp": "2020-09-06 01:00", "bandwidth": "3.20", "flow": "120.00" } ] } ] }