查询边缘节点流量

更新时间:2023-03-28 17:42:08

适用产品

CDN Pro

接口描述

获取一段时间内的边缘流量数据(以MB为单位)。可以使用查询参数指定时间段和协议。通过在请求体中传递filters对象可进一步指定查询范围。该报表的数据延迟小于两分钟。

调用频率

单用户调用频率:300/5min

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Params 参数

参数名称描述
*startdateString
查询范围的开始时间,以RFC 3339日期格式表示。必须使用UTC时区指定时间。示例:startdate=2019-10-30T00:00:00Z。 根据type参数对应的粒度,您指定的开始时间可能被向前取整为最近的分钟、小时或天。例如,如果您指定 startdate=2019-09-05T03:14:01Z&type=hourly,则返回从2019-09-05T03:00:00Z开始的数据。
*enddateString
查询范围的结束时间,以RFC 3339日期格式表示。必须使用UTC时区指定时间。示例:enddate=2019-11-14T00:00:00Z。根据type参数对应的粒度,您指定的结束时间可能被向后取整为最近的分钟、小时或天。例如,如果您指定 enddate=2019-09-05T03:14:01Z&type=hourly,则返回截止到2019-09-05T04:00:00Z的数据。
*typeString
取值范围: fiveminutes, hourly, daily, monthly 指定返回数据的粒度,支持5分钟,小时,日,月粒度。默认情况下,我们以UTC 00:00:00作为一天的开始。如果您希望指定不同的时区,可以附加时区标识,即-12、-11、-10、-9、-8、-7、-6、-5、-4、-3、-2、-1、+1、+2、+3、+4、+5、+6、+7、+8、+9、+10、+11、+12。例如,type=daily+8表示使用UTC+8时区指定一天的开始时间。
schemeString
[ 0 .. 5 ] 字符 取值范围: http, https, all 默认值: all 指定查询HTTP与/或HTTPS协议的数据。默认查询全部2种协议的数据。

Body 参数

参数名称描述
filtersObject
指定查询条件过滤报表数据。
hostnamesList
指定加速域名进行查询。可使用泛域名,如*.domain.com。如果未指定,将返回所有加速域名的数据。
serverGroupsList
取值范围: standard, premium, deluxe, ultra, nearChina, ChinaStandard, ChinaPremium 指定serverGroups(节点组)进行查询。

返回参数

Body 参数

参数名称描述
dataNameString
对返回数据的简要描述。
dataUnitString
计量单位。不同报表类型计量单位不一样。
dataSeriesList
数据点。
timestampString
每个时间段的起始时间,以RFC 3339日期格式表示。始终采用UTC时区。例如:'timestamp': '2019-10-29T01:00:00Z'
dataInteger
该时间段对应的值。计量单位,由dataUnit字段指定。

错误码

错误代码(code)描述(message)HTTP状态码语义
InvalidSchemeInvalid parameter 'scheme': 'invalid'. The value of the scheme parameter must be 'http', 'https' or 'all'.400scheme参数取值无效。必须是'http', 'https' 或 'all'。
InvalidHostnamesDuplicate hostname(s) 'domain.info'.400重复指定域名。
InvalidTimeSpanThe max time span of 'daily' report must be no more than 366 days.400对于报表粒度为月的查询,时间跨度不能超过366天。

示例

200
400
200
请求示例
复制代码 复制成功
#!/bin/bash
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/cdn/report/vol?startdate=2023-01-01T00:00:00Z&enddate=2023-01-02T00:00:00Z&type=daily" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json"
返回示例
复制代码 复制成功
{
    "dataName": "edge response volume",
    "dataUnit": "megabytes",
    "dataSeries": [
        {
            "timestamp": "2019-10-30T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-10-31T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-01T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-02T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-03T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-04T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-05T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-06T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-07T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-08T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-09T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-10T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-11T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-12T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-13T00:00:00Z",
            "data": 0
        },
        {
            "timestamp": "2019-11-14T00:00:00Z",
            "data": 0
        }
    ]
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!