获取 ACL 详情
/v1/acls/{acl_id}根据 ACL ID 获取当前登录用户拥有的一条 ACL 完整配置。服务端同时使用路径中的 acl_id 和当前登录用户 ID 查询,因此目标 ACL 不属于当前账号时与不存在时返回相同错误;管理员身份也不会绕过这项所属用户限制。返回内容是 ACL 表中的原始配置,不包含列表接口联表提供的任务状态、用户名或格式化时间字段。
身份认证
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 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
acl_id | path | integer (int64) | 必填 | 要查询的 ACL ID,目标 ACL 必须属于当前登录用户。 完整参数定义 |
响应
HTTP 200
请求通过 HTTP 200 返回。查询成功时返回 ACL 的完整持久化字段;ACL 不存在或不属于当前登录用户时返回业务错误 acl-30,登录态无效时返回 login_required。
application/json
oneOf
oneOf · 1 · object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 成功状态码,查询到 ACL 时固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
msg | string | 必填 | 详情查询成功时没有额外提示,固定为空字符串。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | object | 必填 | 当前登录用户拥有的 ACL 完整配置。 约束 / 默认值 / 示例展开字段结构当前登录用户拥有的 ACL 完整配置。
|
oneOf · 2 · object
| 字段 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|
code | string | 必填 | 业务错误码: 约束 / 默认值 / 示例 |
msg | string | 必填 | 与业务错误码对应的中文错误原因。 |
data | string | 必填 | 业务错误时固定为空字符串。 约束 / 默认值 / 示例 |
完整 Schema
{
"oneOf": [
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "成功状态码,查询到 ACL 时固定为 0。"
},
"msg": {
"type": "string",
"enum": [
""
],
"description": "详情查询成功时没有额外提示,固定为空字符串。"
},
"data": {
"type": "object",
"required": [
"id",
"uid",
"name",
"des",
"default_action",
"reject_code",
"redirect_url",
"data",
"create_at",
"update_at",
"enable",
"task_id",
"version"
],
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "ACL 的唯一 ID。"
},
"uid": {
"type": "integer",
"format": "int64",
"description": "ACL 所属用户的 ID,与当前登录用户 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 配置版本号,每次更新时递增。"
}
},
"additionalProperties": false,
"description": "当前登录用户拥有的 ACL 完整配置。"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "string",
"enum": [
"acl-30",
"login_required"
],
"description": "业务错误码:`acl-30` 表示 ACL 不存在或无权查看,`login_required` 表示登录态无效。"
},
"msg": {
"type": "string",
"description": "与业务错误码对应的中文错误原因。"
},
"data": {
"type": "string",
"enum": [
""
],
"description": "业务错误时固定为空字符串。"
}
},
"additionalProperties": false
}
]
}示例
{
"code": 0,
"msg": "",
"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
}
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/acls/{acl_id}" \
--header "access-token: YOUR_ACCESS_TOKEN"