API中心

查询多域名的小时粒度状态码

更新时间:2026-07-13 15:49:38

查询各频道每小时粒度状态码分布

  • 数据延迟:30min~1h
  • 单用户调用频率:300/5min
  • 适用产品:静态加速、DDoS云清洗 2.0、DDoS云清洗、应用安全、网站安全 2.0、Bot管理、动态加速、流媒体点播、云点播
API鉴权说明详见:API鉴权概览

请求参数

Body 参数

参数名称描述
dateFromString

开始时间:

1.时间格式为 yyyy-MM-ddTHH:mm:ss±HH:mm。请注意:±HH:mm 为时区偏移量,可根据您的数据需要进行调整,例如 +00:00 代表 UTC 时间,+08:00 代表东八区,-05:00 代表西五区。2024-01-15T10:30:45+00:00,表示UTC 时间 2024 年 1 月 15 日上午 10 点 30 分 45 秒

2.不能大于当前时间

3.最多可获取最近半年(183天)的数据

dateToString

结束时间:

1.时间格式为 yyyy-MM-ddTHH:mm:ss±HH:mm。请注意:±HH:mm 为时区偏移量,可根据您的数据需要进行调整,例如 +00:00 代表 UTC 时间,+08:00 代表东八区,-05:00 代表西五区。2024-01-15T10:30:45+00:00,表示UTC 时间 2024 年 1 月 15 日上午 10 点 30 分 45 秒

2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间

3.dateFrom,dateTo二者都未传,默认查询过去的1天;如仅有一个未传,抛异常

4.允许查询最大时间间隔:31天,即dateFrom和dateTo相差不能超过31天。(可联系技术支持调整)

domainList

域名:

1、可传递域名数量上限默认为20个(可联系技术支持调整);

2、自动过滤掉无效域名(如传递非法域名,会被过滤掉,查询结果只返回有效域名的数据)。

groupByList
  1. 可选值:domain
  2. 不传默认聚合所有频道数据

返回参数

Body 参数

参数名称描述
codeString

接口返回状态

messageString

接口返回信息

dataList
domainString

域名,聚合全部域名数据不返回该字段

statusCodeDataListList
statusCodeString

状态码

detailListList
timestampString

时间片,返回开始时间和结束时间包含的时间片。 时间格式: 小时:yyyy-MM-dd HH:00:00

valueString

状态码次数

错误码

错误代码(code)描述(message)HTTP状态码语义
24102014

This operation requires a body. Ensure that the body is present and the Content-Type header is set.

400请求体没有传递
24102013

The accept header specified in your request is not acceptable.

400Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
24102020

The value of X-Time-Zone header specified in your request in invalid.

400请求头时区不合法
24102002

There was an error in the body of your HTTP request.

400请求体格式错误
24102006

The date specified is invalid.

400dateFrom或dateTo不符合规范或时间区间不合法
24102007

You cannot specify a period greater than xx minutes.

400dateFrom和dateTo相差超过限制值
24102019

The request was rejected because the number of domain(xx) exceeds the limit (xx).

400传递的域名个数超过账号限制
24102008

param: domain is null or invalid.

400参数domain不符合规范
24102008

param: groupBy is null or invalid.

400参数groupBy不符合规范
24102500

We encountered an internal error. Please try again.

500系统发生错误

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/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://api.cdnetworks.com/api/report/status-code/log" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{
  "dateFrom": "2021-11-18T00:00:00+00:00",
  "dateTo": "2021-11-18T10:00:00+00:00",
   "domain":["www.test.com"],
   "groupBy":["domain"]
}'
返回示例
复制代码 复制成功
{
    "code": "0",
    "message": "success",
    "data": [
        {
            "domain": "www.test.com",
            "statusCodeDataList": [
                {
                    "statusCode": "400",
                    "detailList": [
                        {
                            "timestamp": "2021-11-18 01:00",
                            "value": "10"
                        },
                         {
                            "timestamp": "2021-11-18 02:00",
                            "value": "20"
                        }
                    ]
                }
            ]
        }
    ]
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!