版本 2.4.7.20261116085428 · 最新
CC 设置 cc-settings
平台级 CC 默认规则组与自动切换设置,仅管理员可改。
点击任一接口,右侧显示对应的调用示例。
防护鉴权: 仅管理员2 个接口
鉴权
请求头带 X-API-Key(在「API 密钥」页开通,密钥只在开通时显示一次);也可用登录得到的 Authorization: Bearer 令牌。
X-API-Key
鉴权失败回 401;无权回 403(code 为 insufficient_scope 等)。
约定
分页参数 page(从 1 起)、page_size;排序 sort=字段 或 -字段。
时间一律 RFC 3339(UTC);金额单位为分。
写操作成功回 200/201/204;重复提交按资源唯一键回 409。
GET
/api/v2/cc-settings获取 CC 设置
鉴权: 仅管理员
PUT
/api/v2/cc-settings修改 CC 设置
鉴权: 仅管理员
请求体 application/json
| 字段 | 类型 | 说明 |
|---|---|---|
auto_switch必填 | CcAutoSwitch | CC 防护自动升级设置:攻击时自动切换到更严的规则组。 |
default_page_rule_id | integer | 默认页(未绑定域名)用的平台 CC 规则组 id;null 或不带 = 不防护。 |
default_rule_id必填 | integer | 站点未选规则组时用的平台 CC 规则组 id;null = 节点缺省。 |
expected_updated_at | string | 乐观锁:调用方读到的 updated_at(即配置 node.global 的版本,CC/WAF 设置与该键共用;读到为空用 1970-01-01T00:00:00Z)。与库里当前值不等则回 409 stale_version、不保存;不带则不检查。 |
updated_at | string | 响应里的版本(node.global 配置键的 updated_at,没改过为空);修改时忽略,乐观锁用 expected_updated_at。 |
CC 设置对象
| 字段 | 类型 | 说明 |
|---|---|---|
auto_switch | CcAutoSwitch | CC 防护自动升级设置:攻击时自动切换到更严的规则组。 |
default_page_rule_id | integer | 默认页(未绑定域名)用的平台 CC 规则组 id;null 或不带 = 不防护。 |
default_rule_id | integer | 站点未选规则组时用的平台 CC 规则组 id;null = 节点缺省。 |
expected_updated_at | string | 乐观锁:调用方读到的 updated_at(即配置 node.global 的版本,CC/WAF 设置与该键共用;读到为空用 1970-01-01T00:00:00Z)。与库里当前值不等则回 409 stale_version、不保存;不带则不检查。 |
updated_at | string | 响应里的版本(node.global 配置键的 updated_at,没改过为空);修改时忽略,乐观锁用 expected_updated_at。 |
返回与错误
成功直接回资源 JSON(HTTP 2xx);失败回 application/problem+json(code、detail,校验失败带 errors);列表为 items + total。
成功
{
"id": 1,
"name": "example"
}列表
{
"items": [
{
"id": 1
}
],
"page": 1,
"page_size": 20,
"total": 1
}失败
{
"code": "validation_failed",
"detail": "请求参数不合法",
"errors": [
{
"code": "required",
"field": "/name",
"message": "name 必填"
}
],
"request_id": "0123456789abcdef",
"status": 422,
"title": "Unprocessable Entity",
"type": "about:blank"
}