文档中心 API文档 查询精确域名流量

查询精确域名流量

更新时间:2022-11-18 17:43:55

适用产品

直播分发

接口描述

查询精确域名的流量数据。当域名加速配置使用的是泛域名时,可通过该接口查询泛域名对应的精确域名的流量数据。 数据延迟3~5小时,建议查询24小时前的数据;建议调用频率不高于30次/5分钟。

推荐使用 Open API在线调试

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

请求参数

Body 参数

参数名称类型必填描述
dateFrom
String开始时间 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
String{'en':'End Time 1. Time format yyyy-MM-ddTHH:mm:ss+08:00, for example: 2016-12-02T10:00:00+08:00 2. The end time needs to be greater than the start time. If the end time is greater than the current time, the current time is taken. 3. dateFrom, dateTo are not passed, the default query for the past 24 hours; if there is only one untransmitted, throw an exception 4. Allow query maximum time interval: default 1 day, that is, the difference between dateFrom and dateTo can't exceed 1 day (can contact technical support adjustment).', 'zh_CN':'结束时间 1.时间格式yyyy-MM-ddTHH:mm:ss+08:00,例如:2016-12-02T10:00:00+08:00 2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间。 3.dateFrom,dateTo二者都未传,默认查询过去的24小时;如仅有一个未传,抛异常 4.允许查询最大时间间隔:默认1天,即dateFrom和dateTo相差不能超过1天(可联系技术支持调整)。'}
dataInterval
String数据粒度: 1. 支持5m(5分钟粒度)、1d(1天粒度) 2. 不传默认为5m
domain
List域名(即泛域名): 1. 可传递域名数量上限默认为20个(可联系技术支持调整)。 2. 当传入的多个泛域名下的精确域名总数量超过exactDomain配置的可传数量时不可查(报错提示)。 3. 自动过滤掉非法域名(如传递非法域名,会被过滤掉,查询结果只返回合法域名的数据)。
exactDomain
List精确域名 1. 可传递精确域名数量上限默认为200个(可联系技术支持调整) 2. 可以是不同泛域名下的精确域名。

返回参数

Body 参数

参数名称类型描述
result
List结果
exactDomain
String精确域名
flowData
List
timestamp
String时间 1. 查询的数据粒度为5m时,格式为yyyy-MM-dd HH:mm;每一个时间片数据值代表的是前一个时间粒度范围内的数据值。一天开始的时间片是yyyy-MM-dd 00:05,最后一个时间片是(yyyy-MM-dd+1) 00:00。 2. 查询的数据粒度为1d时,格式为yyyy-MM-dd;每一个时间片数据值代表的该天内的数据值。 3. 返回开始时间和结束时间包含的时间片。
value
String流量,计量单位MB,保留2位小数

错误码

错误代码(code)描述(message)HTTP状态码语义
MissingBodyThis   operation requires a body. Ensure that the body is present and the   Content-Type header is set.400请求体没有传递
NotAcceptableThe   accept header specified in your request is not acceptable.400Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
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 1.400dateFrom和dateTo相差超过1天
NumberLimitExceededThe   request was rejected because the number of exactDomain(actual) exceeds the   limit (expect).400传递的精确域名个数超出限制
PARAM_INVALIDparam:   dataInterval is null or invalid.400参数dataInterval不符合规范
InternalErrorWe   encountered an internal error. Please try again.500系统发生错误
NumberLimitExceededThe request was rejected because the number of domain(actual) exceeds the limit (expect).400传递的域名个数超出限制
PARAM_INVALIDparam: domain is null or invalid.400参数domain不符合规范
PARAM_INVALIDparam: exactDomain is null or invalid.400参数exactDomain不符合规范

示例

JSON
XML
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/flow/exact-domain" \
  -X "POST" \
-H "X-Time-Zone:GMT+08:00" \
  -u "$username:$password" \
  -H "Date: $date" \
  -H "Accept: application/json" \
  -d '{
        "dateFrom":"2017-12-02T10:00:00+08:00",
        "dateTo":"2017-12-03T10:00:00+08:00",
        "domain":[
                "*.a.com"
        ],
        "exactDomain":[
                "1.a.com",
                "2.a.com"
        ],
        "dataInterval":"5m"
  }'
返回示例
复制代码 复制成功
{
    "result":[
        {
            "exactDomain":"1.a.com",
            "flowData":[
                {
                    "timestamp":"2018-03-10 00:05",
                    "value":"1.00"
                },
                {
                    "timestamp":"2018-03-10 00:10",
                    "value":"2.00"
                },
                {
                    "timestamp":"2018-03-10 00:15",
                    "value":"3.00"
                }
            ]
        },
        {
            "exactDomain":"2.a.com",
            "flowData":[
                {
                    "timestamp":"2018-03-10 00:05",
                    "value":"1.00"
                },
                {
                    "timestamp":"2018-03-10 00:10",
                    "value":"2.00"
                },
                {
                    "timestamp":"2018-03-10 00:15",
                    "value":"3.00"
                }
            ]
        }
    ]
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!