itecdn 5.x用户文档
itecdn 5.x / 用户 API

分页查询 ACL 列表

GET/v1/acls

分页查询当前身份可见的网站 ACL 规则集。普通用户始终只返回自己的 ACL;管理员默认可查看全部用户的数据,并可通过 uid 限定所属用户。可按 ACL ID、名称、启用状态和任务状态筛选,结果按 ACL ID 倒序排列。响应中的 data 字段是序列化后的 ACL 规则 JSON 字符串,调用方需要在使用规则内容前再次解析。

身份认证

access-token

api-key + api-secret

认证定义
{
  "AccessToken": {
    "type": "apiKey",
    "in": "header",
    "name": "access-token",
    "description": "通过登录接口获得的短期访问令牌。"
  },
  "ApiKey": {
    "type": "apiKey",
    "in": "header",
    "name": "api-key",
    "description": "API Key;必须和 api-secret 同时发送。"
  },
  "ApiSecret": {
    "type": "apiKey",
    "in": "header",
    "name": "api-secret",
    "description": "API Secret;必须和 api-key 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
pagequeryinteger (int32)可选

页码,从 1 开始;省略时为 1。limit=0 时该参数不影响返回范围。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "description": "页码,从 1 开始;省略时为 1。`limit=0` 时该参数不影响返回范围。",
  "schema": {
    "type": "integer",
    "format": "int32",
    "minimum": 1,
    "default": 1
  },
  "example": 1
}
limitqueryinteger (int32)可选

每页返回的 ACL 数量,省略时为 10;传 0 表示不分页并返回全部匹配记录。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "description": "每页返回的 ACL 数量,省略时为 10;传 0 表示不分页并返回全部匹配记录。",
  "schema": {
    "type": "integer",
    "format": "int32",
    "minimum": 0,
    "default": 10
  },
  "example": 10
}
enablequeryinteger可选

按启用状态精确筛选:1 表示已启用,0 表示已禁用。

完整参数定义
{
  "name": "enable",
  "in": "query",
  "required": false,
  "description": "按启用状态精确筛选:1 表示已启用,0 表示已禁用。",
  "schema": {
    "type": "integer",
    "enum": [
      0,
      1
    ]
  },
  "example": 1
}
uidqueryinteger (int64)可选

按 ACL 所属用户 ID 精确筛选,仅管理员身份生效;普通用户传入该参数也只会返回自己的数据。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "description": "按 ACL 所属用户 ID 精确筛选,仅管理员身份生效;普通用户传入该参数也只会返回自己的数据。",
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "example": 2
}
idqueryinteger (int64)可选

按 ACL ID 精确筛选列表。

完整参数定义
{
  "name": "id",
  "in": "query",
  "required": false,
  "description": "按 ACL ID 精确筛选列表。",
  "schema": {
    "type": "integer",
    "format": "int64",
    "minimum": 1
  },
  "example": 1
}
namequerystring可选

按 ACL 名称进行包含匹配。

完整参数定义
{
  "name": "name",
  "in": "query",
  "required": false,
  "description": "按 ACL 名称进行包含匹配。",
  "schema": {
    "type": "string"
  },
  "example": "仅允许中国"
}
statequerystring可选

按关联任务状态筛选。传 done 时同时包含任务已完成和未关联任务的 ACL;其它值按任务状态精确匹配。

完整参数定义
{
  "name": "state",
  "in": "query",
  "required": false,
  "description": "按关联任务状态筛选。传 `done` 时同时包含任务已完成和未关联任务的 ACL;其它值按任务状态精确匹配。",
  "schema": {
    "type": "string"
  },
  "example": "done"
}

响应

HTTP 200

请求始终通过 HTTP 200 返回。成功时给出匹配总数和当前页 ACL 列表;页码或每页数量格式错误、登录态失效时,通过字符串 code 和 msg 返回业务错误。

application/json

oneOf

oneOf · 1 · object
字段类型必填说明与约束
codeinteger必填

成功状态码,列表查询成功时固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
countinteger (int64)必填

符合筛选条件的 ACL 总数,不受当前页 limit 限制。

约束 / 默认值 / 示例
{
  "format": "int64",
  "minimum": 0
}
dataarray <object>必填

当前页的 ACL 记录,按 ACL ID 从大到小排列。

展开字段结构

当前页的 ACL 记录,按 ACL ID 从大到小排列。

数组元素 · object
字段类型必填说明与约束
idinteger (int64)必填

ACL 的唯一 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
uidinteger (int64)必填

ACL 所属用户的 ID。

约束 / 默认值 / 示例
{
  "format": "int64"
}
namestring必填

ACL 名称,同一用户下不可重名。

desstring必填

ACL 的备注说明,可为空字符串。

default_actionstring必填

所有 ACL 规则均未匹配时执行的默认动作。

约束 / 默认值 / 示例
{
  "enum": [
    "reject",
    "allow"
  ]
}
reject_codestring必填

拒绝请求时使用的响应方式:403 表示直接拒绝,302 表示重定向。

约束 / 默认值 / 示例
{
  "enum": [
    "403",
    "302"
  ]
}
redirect_urlstring必填

reject_code 为 302 时使用的重定向地址,否则通常为空字符串。

datastring必填

序列化后的 ACL 规则 JSON 数组;每条规则包含动作、匹配条件,并可包含拒绝代码和跳转地址。

create_atstring必填

ACL 的数据库创建时间;历史数据未记录时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
update_atstring必填

ACL 的数据库最后更新时间;历史数据未记录时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
enableinteger必填

ACL 启用状态:1 表示启用,0 表示禁用。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ]
}
task_idinteger (int64)必填

最近一次 ACL 同步或删除任务的 ID;没有关联任务时为 null。

约束 / 默认值 / 示例
{
  "format": "int64",
  "nullable": true
}
versioninteger (int64)必填

ACL 配置版本号,每次更新时递增。

约束 / 默认值 / 示例
{
  "format": "int64"
}
statestring必填

关联任务的当前状态;没有关联任务时为 null。

约束 / 默认值 / 示例
{
  "nullable": true
}
create_at2string必填

格式化为 YYYY-MM-DD HH:mm:ss 的创建时间,供界面展示。

update_at2string必填

格式化为 YYYY-MM-DD HH:mm:ss 的最后更新时间,供界面展示。

usernamestring必填

ACL 所属用户的名称。

oneOf · 2 · object
字段类型必填说明与约束
codestring必填

业务错误码,例如 acl-31 表示 page 格式错误、acl-32 表示 limit 格式错误、login_required 表示登录态无效。

msgstring必填

与业务错误码对应的中文错误原因。

datastring必填

业务错误时固定为空字符串。

约束 / 默认值 / 示例
{
  "enum": [
    ""
  ]
}
完整 Schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "code",
        "count",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "enum": [
            0
          ],
          "description": "成功状态码,列表查询成功时固定为 0。"
        },
        "count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "符合筛选条件的 ACL 总数,不受当前页 `limit` 限制。"
        },
        "data": {
          "type": "array",
          "description": "当前页的 ACL 记录,按 ACL ID 从大到小排列。",
          "items": {
            "type": "object",
            "required": [
              "id",
              "uid",
              "name",
              "des",
              "default_action",
              "reject_code",
              "redirect_url",
              "data",
              "create_at",
              "update_at",
              "enable",
              "task_id",
              "version",
              "state",
              "create_at2",
              "update_at2",
              "username"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64",
                "description": "ACL 的唯一 ID。"
              },
              "uid": {
                "type": "integer",
                "format": "int64",
                "description": "ACL 所属用户的 ID。"
              },
              "name": {
                "type": "string",
                "description": "ACL 名称,同一用户下不可重名。"
              },
              "des": {
                "type": "string",
                "description": "ACL 的备注说明,可为空字符串。"
              },
              "default_action": {
                "type": "string",
                "enum": [
                  "reject",
                  "allow"
                ],
                "description": "所有 ACL 规则均未匹配时执行的默认动作。"
              },
              "reject_code": {
                "type": "string",
                "enum": [
                  "403",
                  "302"
                ],
                "description": "拒绝请求时使用的响应方式:403 表示直接拒绝,302 表示重定向。"
              },
              "redirect_url": {
                "type": "string",
                "description": "`reject_code` 为 302 时使用的重定向地址,否则通常为空字符串。"
              },
              "data": {
                "type": "string",
                "description": "序列化后的 ACL 规则 JSON 数组;每条规则包含动作、匹配条件,并可包含拒绝代码和跳转地址。"
              },
              "create_at": {
                "type": "string",
                "nullable": true,
                "description": "ACL 的数据库创建时间;历史数据未记录时为 null。"
              },
              "update_at": {
                "type": "string",
                "nullable": true,
                "description": "ACL 的数据库最后更新时间;历史数据未记录时为 null。"
              },
              "enable": {
                "type": "integer",
                "enum": [
                  0,
                  1
                ],
                "description": "ACL 启用状态:1 表示启用,0 表示禁用。"
              },
              "task_id": {
                "type": "integer",
                "format": "int64",
                "nullable": true,
                "description": "最近一次 ACL 同步或删除任务的 ID;没有关联任务时为 null。"
              },
              "version": {
                "type": "integer",
                "format": "int64",
                "description": "ACL 配置版本号,每次更新时递增。"
              },
              "state": {
                "type": "string",
                "nullable": true,
                "description": "关联任务的当前状态;没有关联任务时为 null。"
              },
              "create_at2": {
                "type": "string",
                "description": "格式化为 `YYYY-MM-DD HH:mm:ss` 的创建时间,供界面展示。"
              },
              "update_at2": {
                "type": "string",
                "description": "格式化为 `YYYY-MM-DD HH:mm:ss` 的最后更新时间,供界面展示。"
              },
              "username": {
                "type": "string",
                "description": "ACL 所属用户的名称。"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "code",
        "msg",
        "data"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "业务错误码,例如 `acl-31` 表示 page 格式错误、`acl-32` 表示 limit 格式错误、`login_required` 表示登录态无效。"
        },
        "msg": {
          "type": "string",
          "description": "与业务错误码对应的中文错误原因。"
        },
        "data": {
          "type": "string",
          "enum": [
            ""
          ],
          "description": "业务错误时固定为空字符串。"
        }
      },
      "additionalProperties": false
    }
  ]
}

示例

{
  "code": 0,
  "count": 1,
  "data": [
    {
      "id": 1,
      "uid": 2,
      "name": "仅允许中国访问",
      "des": "示例 ACL",
      "default_action": "reject",
      "reject_code": "403",
      "redirect_url": "",
      "data": "[{\"acl_action\":\"allow\",\"acl_matcher\":[{\"item\":\"country_iso_code\",\"op\":\"=\",\"value\":\"cn\"}]}]",
      "create_at": "2026-07-28 09:00:00",
      "update_at": "2026-07-28 09:00:00",
      "enable": 1,
      "task_id": null,
      "version": 1,
      "state": null,
      "create_at2": "2026-07-28 09:00:00",
      "update_at2": "2026-07-28 09:00:00",
      "username": "example-user"
    }
  ]
}

cURL 示例

根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。

curl --request GET \
  "https://master.example.invalid/v1/acls" \
  --header "access-token: YOUR_ACCESS_TOKEN"

查看完整接口 JSON