设置用量封顶接口
更新时间:2026-10-15
接口
本接口用于设置用量封顶。
请求接口
| Method | Path | 说明 |
|---|---|---|
| POST | /v2/geo/limit-consumption?action=update | 设置用量封顶 |
请求体
| 参数 | 类型 | 说明 |
|---|---|---|
| site | String | 站点名称。 |
| object | String | 生效对象。如果值为“site”,表示为“站点”,其他的为站点下的域名。 |
| enabled | Bool | 开启/关闭用量封顶配置。“enabled” 值为 “true” 时,表示开启;值为“false”时,表示关闭。 |
| type | String | 检测类型,其合法值为: • flow:流量 • bandwidth:带宽 • pv:请求数 |
| threshold | String | 检测阈值,"type" 不同时,单位不同。"type" 值为 "flow" 时,合法单位为 "MB"、"GB"、"TB"。"type" 值为 "bandwidth" 时,合法单位为 "Mbps"、"Gbps" 或 "Tbps"。"type" 值为 "pv" 时,填写数值即可,如“1234”。 |
| statisticalCycle | Int | 检测周期,单位为秒,"enabled" 值为 "true" 时必选。合法值为 "300" 、"3600" 或 "86400"。"type" 值为 "bandwidth" 时,固定取值为 "300"。当 "type" 值为 "pv" 或 "flow" 时,合法值为 "300"、"3600" 或 "86400"。 |
| action | String | 达到阈值时触发的动作,固定值为 “stop”, 表示停止加速域名。 |
响应码
| HTTP Status Code | 说明 |
|---|---|
| 200 | 设置成功 |
| 400 | 设置用量封顶请求参数无效 |
| 500 | 服务端错误 |
响应体
| 参数 | 类型 | 说明 |
|---|---|---|
| success | Bool | 设置用量封顶成功 |
请求示例1:设置站点的用量封顶
Plain Text
1POST /v2/geo/limit-consumption?action=update HTTP/1.1
2Host: geo.baidubce.com
3Authorization: xxx
4Content-Type: application/json;charset=utf-8
5Accept-Encoding: gzip
6{
7 "site": "test-eo.com",
8 "object": "site",
9 "enabled": true,
10 "type": "flow",
11 "threshold": "100GB",
12 "statisticalCycle": 300,
13 "action": "stop"
14}
请求示例2:设置域名的用量封顶
Plain Text
1POST /v2/geo/limit-consumption?action=update HTTP/1.1
2Host: geo.baidubce.com
3Authorization: xxx
4Content-Type: application/json;charset=utf-8
5Accept-Encoding: gzip
6{
7 "site": "test-eo.com",
8 "object": "1.test-eo.com",
9 "enabled": true,
10 "type": "flow",
11 "threshold": "100GB",
12 "statisticalCycle": 3600,
13 "action": "stop"
14}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Content-Type: application/json; charset=utf-8
4Transfer-Encoding: chunked
5Connection: keep-alive
6{
7 "success": true
8}
评价此篇文章
