所有文档

          内容分发网络 CDN

          统计接口(新版)

          Method Path 说明
          POST /v2/stat/query 所有统计数据的路径,不同的统计指标由post参数中的metric指定。

          默认请求体(Request Body)

          所有metric支持的参数以此进行扩展。

          参数 可选 类型 说明
          metric 必选 String 指定avg_speed,avg_speed_region,pv,pv_region等
          endTime 可选 Timestamp 查询的时间范围结束值,默认为当前时间。时间跨度最长90天 UTC时间
          startTime 可选 Timestamp 查询的时间范围起始值,默认为endTime前推24小时 UTC时间
          period 可选 Long 查询结果的粒度,单位秒,可选值为60,300,3600,86400;默认为300,uv 默认3600(选60s的时间粒度时建议startTime和endTime区间跨度建议选择0.5到1h,否则可能会因为数据量太大无法正常返回)
          key_type 可选 Long 标识key的内容,0=>域名,1=>用户id,2=>tag,默认0
          key 可选 list<String> 域名或用户Id或Tag
          groupBy 可选 String 返回结果聚合粒度,key => 根据key聚合, 空 => 返回整体结果

          默认响应体(Response Body)

          所有metric的响应结果以此扩展。

          参数 类型 说明
          status String 正常返回的时候为"ok"
          details list<Details> list类型
          count Long list的长度

          Details 内容

          参数 类型 说明
          timestamp Timestamp 时间点 UTC时间
          key String 聚合粒度(groupBy):key => key,其他 => total
          ... Object 扩展字段,metric对应的统计指标

          平均速率相关接口

          查询平均速率

          metric:avg_speed

          响应体扩展字段:

          参数 类型 说明
          avgspeed Long 统计时间段内的平均速率

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"avg_speed","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","avgspeed": 1219463},
                  {"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","avgspeed": 1289562}
              ],
              "count": 2
          }

          客户端访问分布查询平均速率

          metric:avg_speed_region

          请求体扩展字段:

          参数 可选 类型 说明
          prov 可选 String 查询的省份全拼,默认为空,查询全国数据。
          isp 可选 String 查询的运营商代码,默认为空,查询所有运营商数据。

          响应体扩展字段:

          参数 类型 说明
          distribution list<DistributionData> 客户端访问分布数据

          DistributionData内容

          参数 类型 说明
          location String 客户端所在省份、地区
          isp String 客户端所属运营商
          avgspeed Long 统计时间段内的平均速率

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
          
          {"metric":"avg_speed_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","avgspeed": 1683448}]},
                  {"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","avgspeed": 1964874}]}
              ],
              "count": 2
          }

          pv/qps相关接口

          pv/qps查询

          metric:pv

          请求体扩展字段:

          参数 可选 类型 说明
          level 可选 String 查询边缘节点或者中心节点pv。可填写"all"或"edge"或者"internal",默认为“all”

          响应体扩展字段:

          参数 类型 说明
          pv Long 统计时间段内的请求量
          qps Long 统计时间段内的平均qps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"pv","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","level":"all"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"pv": 2145,"qps": 7,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"pv": 2950,"qps": 9,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          回源pv/qps查询

          metric:pv_src

          响应体扩展字段:

          参数 类型 说明
          pv Long 统计时间段内的回源请求量
          qps Long 统计时间段内的平均qps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"pv_src","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"pv": 0,"qps": 0,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"pv": 0,"qps": 0,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          查询pv/qps(分客户端访问分布)

          metric: pv_region

          请求体扩展字段:

          参数 可选 类型 说明
          prov 可选 String 查询的省份全拼,默认为空,查询全国数据。
          isp 可选 String 查询的运营商代码,默认为空,查询所有运营商数据。

          响应体扩展字段:

          参数 类型 说明
          distribution list<DistributionData> 客户端访问分布数据

          DistributionData内容

          参数 类型 说明
          location String 客户端所在省份、地区
          isp String 客户端所属运营商
          pv Long 统计时间段内的请求量
          qps Long 统计时间段内的平均qps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"pv_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","pv": 148,"qps": 0}]},
                  {"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","pv": 142,"qps": 0}]}
               ],
              "count": 2
          }

          uv查询

          metric:uv

          响应体扩展字段:

          参数 类型 说明
          uv Long 统计时间段内的请求量

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"uv","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"uv": 127994,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"uv": 12700,"timestamp": "2019-03-20T06:05:00Z",key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          流量带宽接口

          查询流量、带宽

          metric: flow

          请求体扩展字段:

          参数 可选 类型 说明
          level 可选 String 查询边缘节点或者中心节点带宽。可填写"all"或"edge"或"internal",默认为"all"

          响应体扩展字段:

          参数 类型 说明
          flow Long 统计时间段内的传输字节数
          bps Long 统计时间段内的平均bps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"flow","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","level":"all"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"flow": 88186275,"bps": 2351634,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"flow": 90383520,"bps": 2410227,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          查询流量、带宽(分协议)

          metric: flow_protocol

          请求体扩展字段:

          参数 可选 类型 说明
          protocol 可选 String 查询http或https的流量、带宽, 取值{'http', 'https', 'all'},默认‘all’

          响应体扩展字段:

          参数 类型 说明
          flow Long 统计时间段内的传输字节数
          bps Long 统计时间段内的平均bps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"flow_protocol","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","protocol":"all"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"flow": 88186275,"bps": 2351634,"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"flow": 90383520,"bps": 2410227,"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          查询流量、带宽(分客户端访问分布)

          metric: flow_region

          请求体扩展字段:

          参数 可选 类型 说明
          prov 可选 String 查询的省份全拼,默认为空,查询全国数据。
          isp 可选 String 查询的运营商代码,默认为空,查询所有运营商数据。

          响应体扩展字段:

          参数 类型 说明
          distribution list<DistributionData> 客户端访问分布数据

          DistributionData内容

          参数 类型 说明
          location String 客户端所在省份、地区
          isp String 客户端所属运营商
          flow Long 统计时间段内的传输字节数
          bps Long 统计时间段内的平均bps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"flow_region","startTime":"2019-03-19T06:00:00Z","endTime":"2019-03-19T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-19T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","flow": 918742,"bps": 24499}]},
                  {"timestamp": "2019-03-19T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","flow": 881491,"bps": 23506}]}
              ],
              "count": 2
          }

          查询月95峰值带宽

          method path 说明
          POST /v2/billing 开放查询统计接口

          请求参数

          参数 可选 类型 说明
          domains 可选 string 为','分隔的域名或标签
          type 必选 string 值为peak95,表查询月95带宽数据
          withTag 可选 bool 表示查询对象为tag还是domain,默认按 domain 查询,当参数值为 true时表按 tag 查询
          byTime 可选 bool 表示是否按整月查询,默认按整月查询,当参数值为true时表按输入时间查询
          billingMonth 可选 string 整月查询时的开始查询月份,格式形如"year-month"。默认值为本月
          startTime 可选 string 开始时间,UTC格式。默认值为当前时间前24小时
          endTime 可选 string 结束时间,UTC格式。默认值为当前时间

          返回参数

          参数 可选 类型 说明
          billing_details 必选 billing_detail 查询的数据

          billing_detail 类型说明

          参数 可选 类型 说明
          bill_band 必选 int 95带宽值
          bill_time 必选 string 该数据点的时间

          请求示例

          HTTP/1.1 200 OK
          Server: nginx
          Date: Thu, 19 Dec 2019 04:26:40 GMT
          Content-Type: application/json; charset=utf-8
          Transfer-Encoding: chunked
          Connection: keep-alive
          X-Powered-By: PHP/7.1.5
          x-bce-request-id: aca2dd9e-77a6-7de8-b9d9-7561fb330ba5
           
          {
              "type": "peak95",
              "byTime": false, // byTime 为 false 时 startTime,endTime 参数无效
              "startTime": "2019-12-17T16:00:00Z",
              "endTime": "2019-12-18T06:53:33Z",
              "billingMonth": "2018-11"
          }

          返回示例

          {
              "billing_details": {
                  "bill_band": 14536504775,
                  "bill_time": "2018-11-17T12:20:00Z"
              }
          }

          查询回源流量、回源带宽

          metric:src_flow

          响应体扩展字段:

          参数 类型 说明
          flow Long 统计时间段内的传输字节数
          bps Long 统计时间段内的平均bps

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"src_flow","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
          {
              "status": "ok",
              "details": [
                  {"flow": 0,"bps": 0,"timestamp": "2019-03-20T06:00:00Z"},
                  {"flow": 0,"bps": 0,"timestamp": "2019-03-20T06:05:00Z"}
              ],
              "count": 2
          }

          命中率类接口

          字节命中率查询

          metric:real_hit

          响应体扩展字段:

          参数 类型 说明
          hitrate Double 统计时间段内的字节命中率

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"real_hit","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","hitrate": 1},
                  {"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","hitrate": 1}
              ],
              "count": 2
          }

          请求命中率查询

          metric:pv_hit

          响应体扩展字段:

          参数 类型 说明
          hitrate Double 统计时间段内的pv命中率

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"pv_hit","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","hitrate": 1},
                  {"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","hitrate": 1}
              ],
              "count": 2
          }

          状态码类接口

          状态码统计查询

          metric:httpcode

          响应体扩展字段:

          参数 类型 说明
          counters list<KvCounter> HTTP状态码计数

          KvCounter内容

          参数 类型 说明
          name String 统计项
          count Long 统计计数

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"httpcode","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"counters": [{"name": 200,"count": 14205},{"name": 499,"count": 27}],"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"counters": [{"name": 200,"count": 14558}],"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          回源状态码查询

          metric:src_httpcode

          响应体扩展字段:

          参数 类型 说明
          counters list<KvCounter> HTTP状态码计数

          KvCounter内容

          参数 类型 说明
          name String 统计项
          count Long 统计计数

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"src_httpcode","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"counters": [{"name": 200,"count": 14205},{"name": 499,"count": 27}],"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net"},
                  {"counters": [{"name": 200,"count": 14558}],"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net"}
              ],
              "count": 2
          }

          状态码统计查询(分客户端访问分布)

          metric:httpcode_region

          请求体扩展字段:

          参数 可选 类型 说明
          prov 可选 String 查询的省份全拼,默认为空,查询全国数据。
          isp 可选 String 查询的运营商代码,默认为空,查询所有运营商数据。

          响应体扩展字段:

          参数 类型 说明
          distribution list<HttpCodeDistributionData> 按客户端访问地域分布的数据详情

          HttpCodeDistributionData 内容

          参数 类型 说明
          location String 客户端所在省份、地区
          isp String 客户端所属运营商
          counters list<KvCounter> HTTP状态码计数

          KvCounter内容

          参数 类型 说明
          name String 统计项
          count Long 统计计数

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"httpcode_region","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","prov":"beijing","isp":"ct"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","counters": [{"name": 200,"count": 137}]}]},
                  {"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","distribution": [{"location": "北京","isp": "电信","counters": [{"name": 200,"count": 141}]}]}
              ],
              "count": 2
          }

          TopN查询接口

          TopN urls

          按pv排序的top urls

          metric:top_urls

          请求体扩展字段:

          参数 可选 类型 说明
          extra 可选 Long 查询指定http状态码的记录,默认值: ""

          响应体扩展字段:

          参数 类型 说明
          counters list<TopNCounter> Top100 统计
          total_pv Long 总pv
          total_flow Long 总流量

          TopNCounter

          参数 类型 说明
          name String url
          pv Long pv
          flow Long flow
          filesize Long 文件大小 单位byte
          filetype String 文件类型 url资源后缀

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"top_urls","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {
                      "timestamp": "2019-03-20T06:00:00Z",
                      "key": "cdaa.wonter.net",
                      "counters": [
                          {"name": "https://cdaa.wonter.net/htpoty.gif","flow": 901459555.7,"pv": 145364, "filetype":"gif", "filesize":3},
                          {"name": "http://cdaa.wonter.net/htpoty.gif","flow": 391129.2,"pv": 63, "filetype":"gif", "filesize":3}
                      ],
                      "total_pv": XX,
                      "total_flow": XX
                  }
              ],
              "count": 1
          }

          TopN referers

          metric:top_referers

          说明:按pv排序的top referers

          请求体扩展字段:

          参数 可选 类型 说明
          extra 可选 Long 查询指定http状态码的记录,默认值: ""

          响应体扩展字段:

          参数 类型 说明
          counters list<TopNCounter> Top100 统计
          total_pv Long 总pv
          total_flow Long 总流量

          TopNCounter

          参数 类型 说明
          name String refer
          pv Long pv
          flow Long flow

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"top_referers","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {
                      "timestamp": "2019-03-20T06:00:00Z",
                      "key": "cdaa.wonter.net",
                      "counters": [
                          {"name": "https://www.baidu.com/s","flow": 541193408.8,"pv": 87177},
                          {"name": "https://www.baidu.com/","flow": 240400970.7,"pv": 38723}
                      ],
                      "total_pv": XX,
                      "total_flow": XX
                  }
              ],
              "count": 1
          }

          TopN domains

          metric:top_domains

          说明:按pv排序的top domains

          请求体扩展字段:

          参数 可选 类型 说明
          extra 可选 Long 查询指定http状态码的记录,默认值: ""

          响应体扩展字段:

          参数 类型 说明
          counters list<TopNCounter> Top100 统计
          total_pv Long 总pv
          total_flow Long 总流量

          TopNCounter

          参数 类型 说明
          name String domains
          pv Long pv
          flow Long flow

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"top_domains","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key","extra":200}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {
                      "timestamp": "2019-03-20T06:00:00Z",
                      "key": "cdaa.wonter.net",
                      "counters": [
                          {"name": "cdaa.wonter.net","flow": 901860646.5,"pv": 145276}
                      ],
                      "total_pv": 145276,
                      "total_flow": 901860646.5
                  }
              ],
              "count": 1
          }

          查询 IPV6 HTTP、HTTPS 独立数据接口

          method path 说明
          post /v2/stat/ipv6?stat_type=http/https/all 查询ipv6 http,https 独立数据,stat_type 表查询的数据类型,值为为 http 时表查询的 http 数据,值为 https 时表查询的 https 的数据,值为 all 时表查询的包含http,hppts的总数据。默认查询all

          请求体(Request Body)

          参数 可选 类型 说明
          startTime 可选 Timestamp 查询的时间范围起始值,默认为endTime前推24小时 UTC时间
          endTime 可选 Timestamp 查询的时间范围结束值,默认为当前时间。时间跨度最长90天 UTC时间
          period 可选 unsigned int 查询的时间粒度,单位为s,默认值为 300s
          keys 可选 list 查询的域名列表,当该列表为空是查询该用户的所有域名的数据

          响应体(Request Body)

          参数 可选 类型 说明
          details 必选 map<timesmap:map<domain:Data>> 查询结果,其中 timesmap 为 UTC 格式时间,domain 为域名或者 userId。Data 为某个时间点某个域名/用户的数据
          count 必选 unsigned int 查询到到数据条数

          Data 类型说明:

          参数 可选 类型 说明
          flow 必选 unsigned int 查询的流量数据
          pv 必选 unsigned int 查询的pv数据
          code 必选 list<map<xxx:unsigned int> 查询的code码数据

          请求示例

          POST /v2/stat/ipv6?stat_type=all
          Host: cdn.baidubce.com
          {
              "startTime": "2019-12-24T02:25:00Z",
              "endTime": "2019-12-24T03:25:00Z",
              "period": 3600,
              "keys": [
                  "aod-image.baidu.com"
              ]
          }

          响应示例

          {
              "count": 3,
              "details": {
                  "2019-12-24T02:00:00Z": {
                      "aod-image.baidu.com": {
                          "flow": 139997226623,
                          "pv": 908930,
                          "code": {
                              "200": 873287,
                              "206": 483,
                              "304": 35160,
                              "400": 2,
                              "403": 124,
                              "404": 742,
                              "408": 15,
                              "499": 20690
                          }
                      }
                  },
                  "2019-12-24T03:00:00Z": {
                      "aod-image.baidu.com": {
                          "flow": 135650008641,
                          "pv": 880724,
                          "code": {
                              "200": 842964,
                              "206": 509,
                              "304": 37251,
                              "400": 3,
                              "403": 6,
                              "404": 688,
                              "429": 35,
                              "499": 21488
                          }
                      }
                  },
                  "2019-12-24T04:00:00Z": {
                      "aod-image.baidu.com": {
                          "flow": 150710137539,
                          "pv": 972031,
                          "code": {
                              "200": 930822,
                              "206": 644,
                              "304": 40565,
                              "400": 3,
                              "403": 9,
                              "404": 568,
                              "408": 2,
                              "499": 27174
                          }
                      }
                  }
              }
          }

          cdn错误码分类统计查询

          metric:error

          响应体扩展字段:

          参数 类型 说明
          counters list<KvCounter> 错误状态码类型及对应计数

          KvCounter内容

          参数 类型 说明
          code String 错误码
          counters list<DetailData> 错误类型及计数

          DetailData 内容

          参数 类型 说明
          name String 错误类型
          count Long 统计计数

          请求示例

          POST /v2/stat/query HTTP/1.1
          Host: cdn.baidubce.com
            
          {"metric":"error","startTime":"2019-03-20T06:00:00Z","endTime":"2019-03-20T06:10:00Z","period":300,"key_type":0,"key":["cdaa.wonter.net"],"groupBy":"key"}

          返回示例

          HTTP/1.1 200 OK
          Content-Length: 190
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN
           
          {
              "status": "ok",
              "details": [
                  {"timestamp": "2019-03-20T06:00:00Z","key": "cdaa.wonter.net","counters": [{"code": 499,"counters": [{"name": "未知","count": 27}]}]},
                  {"timestamp": "2019-03-20T06:05:00Z","key": "cdaa.wonter.net","counters": [{"code": 499,"counters": [{"name": "未知","count": 18}]}]}
              ],
              "count": 2
          }

          错误类型分类

          名称 备注
          源站错误 4xx和5xx
          源站错误,CDN已缓存 4xx和5xx
          CDN错误 4xx和5xx
          未命中499 499
          命中499 499
          CDN连接源站读超时 5xx
          CDN连接源站失败 5xx
          CDN连接源站失败(SSL) 5xx
          CDN解析源站域名失败 5xx
          CDN与源站交互失败 5xx
          未知 未匹配到的错误类型
          上一篇
          域名配置接口
          下一篇
          统计接口(旧版)