查询用量封顶
更新时间:2025-08-05
查询用量封顶
接口描述
本接口用于查询指定加速域名的用量封顶配置。
Method | Path | 说明 |
---|---|---|
GET | /v2/domain/{domain}/config?limitConsumption | 查询用量封顶配置 |
其中,domain : 表示 CDN 加速域名。
请求头域
除公共头域外,无其它特殊头域。
请求体(Request Body)
参数名称 | 可选 | 参数类型 | 参数说明 |
---|---|---|---|
limitConsumption | 必选 | LimitConsumption | 用量封顶配置 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名称 | 可选 | 参数类型 | 参数说明 |
---|---|---|---|
limitConsumption | 必选 | LimitConsumption | 用量封顶配置 |
LimitConsumption 类型说明
参数名称 | 参数类型 | 参数说明 |
---|---|---|
enabled | Bool | 开启/关闭用量封顶配置。enabled 值为 true 时,表示开启。 |
activated | Bool | 是否已经触发阈值,执行 action。activated 值为 true 时,表示已触发。 |
type | String | 检测类型,合法值为 flow、bandwidth、pv 或 qps。 |
threshold | String | 检测阈值,type 不同时,单位不同。type 值为 flow 时,合法单位为 GB、TB 或 PB。type 值为 bandwidth 时,合法单位为 Mbps、Gbps 或 Tbps。type 值为 pv 或 qps 时,填写数值即可,如“1234”。 |
statisticalCycle | Int | 检测周期,单位为秒,enable 值为 true 时必选。合法值为 300 、3600 或 86400。type 值为 bandwidth 或 qps 时,固定取值为 300。当type 值为 pv 或 flow 时,合法值为 3600 或 86400。 |
action | String | 达到阈值时触发的动作,deny 或 stop。其中,stop 表示停止加速域名,deny 表示拒绝所有请求,访问会返回 404。 |
recoverAfterSeconds | Int | 触发阈值,执行 action 后自动恢复的时间。单位为秒,enable 为 true 时必选。合法值为 -1 、3600 、86400或 259200,-1 表示不自动恢复,其他取值恢复时间存在一定延迟,最多延迟 10min。 |
notification | List<String> | 触发阈值后的通知方式,分别为 sms(短信)、 mail(邮件)或 internal_message(站内信)。 |
请求示例
Plain Text
1GET /v2/domain/myself.baidu.com/config?limitConsumption HTTP/1.1
2Host: cdn.baidubce.com
3Accept: application/json
4Authorization: xxxxxx
5Content-Type: application/json
6x-bce-date: 2025-08-05T06:47:54Z
7x-bce-request-id: a3e77bfb-a33e-43aa-9b27-1cf089181426
响应示例1:未触发用量阈值
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Date: Fri, 18 Jul 2025 06:47:54 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/7.1.15
8x-bce-request-id: a3e77bfb-a33e-43aa-9b27-1cf089181426
9
10{
11 "limitConsumption": {
12 "enabled": true,
13 "statisticalCycle": 300,
14 "action": "deny",
15 "recoverAfterSeconds": -1,
16 "notification": [
17 "mail"
18 ],
19 "type": "bandwidth",
20 "threshold": "500Mbps"
21 }
22}
响应示例2:已触发用量阈值
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Date: Fri, 18 Jul 2025 06:48:51 GMT
4Content-Type: application/json; charset=utf-8
5Transfer-Encoding: chunked
6Connection: keep-alive
7X-Powered-By: PHP/7.1.15
8x-bce-request-id: b9f57cdb-b53e-43fa-db23-7gw152525315
9
10{
11 "limitConsumption": {
12 "enabled": true,
13 "activated": true,
14 "statisticalCycle": 300,
15 "action": "deny",
16 "recoverAfterSeconds": -1,
17 "notification": [
18 "mail"
19 ],
20 "type": "bandwidth",
21 "threshold": "500Mbps"
22 }
23}