获取¶
GET /api/v1/blacklist/{blist_uuid}/get
概述¶
读取当前空间指定黑名单规则的完整保存配置。
调用前和使用步骤¶
从列表选择blist_uuid,可读取status=0/2的规则。返回filters为原始输入,conditions为生成的实际条件,不含列表的creatorInfo/updatorInfo。目标跨空间、已删除或不存在均返回404。
本次只读取当前规则配置,不保存规则、不变更下游生效状态;条件含义以本页返回字段为准。
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| blist_uuid | string | Y | 当前空间未删除规则路径UUID;启用和禁用规则均可读取/修改。 允许 null: False 例子: blist_example获取或填写方式: 从黑名单列表content.data[].uuid取得。 |
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI 鉴权凭据。 例子: <DF-API-KEY>获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。 |
请求例子¶
curl --get 'https://openapi.guance.com/api/v1/blacklist/blist_example/get' \
-H 'DF-API-KEY: <DF-API-KEY>'
响应¶
HTTP 200,application/json。下方示例展示可直接读取的主要字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.id | integer | 已存在黑名单规则的数据库编号,调用使用uuid。 |
| content.uuid | string | blist_规则UUID。 |
| content.workspaceUUID | string | 所属空间UUID。 |
| content.name | string | 规则名称。 |
| content.desc | string | 规则描述。 |
| content.type | string | 数据类别。 |
| content.source | string | 保存的单一/全部来源表达,可能为空。 |
| content.sources | array<string> |
保存的多个来源名,非空时优先。 |
| content.sources[] | string | 单个来源名。 |
| content.filters | array<object> 或 object 或 null | 原始条件数组,历史记录也可能为{}或null。 |
| content.filters[].name | string | 叶子字段名或历史组占位名称。 |
| content.filters[].condition | string | 同层连接符。 |
| content.filters[].operation | string | 运算符,历史项可能使用op而省略。 |
| content.filters[].op | string | 历史运算符别名,可省略。 |
| content.filters[].value | JSON | 保存的值或值数组。 |
| content.filters[].value[] | JSON | 单个原始值。 |
| content.filters[].filters | array<object> |
嵌套条件组,可省略;递归同条件结构。 |
| content.conditions | string | 生成供过滤执行使用的条件表达式;数值转换结果看此字段,不直接回写。 |
| content.status | integer | 0启用、2禁用、3删除;非删除查询包含禁用。 |
| content.creator | string | 创建身份UUID。 |
| content.updator | string | 更新身份,可为空。 |
| content.createAt | integer | 创建Unix秒。 |
| content.updateAt | integer | 最近更新Unix秒,未更新-1。 |
| content.deleteAt | integer | 软删除Unix秒,未删除-1。 |
| content.declaration | object 或 null | 非空业务对象附带的工作空间公共声明,未配置时可为null或空对象。 |
{
"code": 200,
"content": {
"id": 10,
"uuid": "blist_example",
"workspaceUUID": "wksp_example",
"name": "忽略健康检查日志",
"desc": "过滤生产nginx健康检查请求。",
"type": "logging",
"source": "nginx",
"sources": [],
"filters": [
{
"name": "path",
"condition": "and",
"operation": "=",
"value": [
"/healthz"
]
}
],
"conditions": "{ `source` = 'nginx' and (`path` = '/healthz' )}",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 404 | ft.InvalidBlacklistuuid | 当前空间未找到指定非删除规则 | 黑名单不存在 | 重新从当前空间列表取得有效UUID。 |
| 500 | ft.InternalServerError | 规则读取或响应格式化失败 | 内部错误 | 核对查询条件及UUID后重试;持续失败提供traceId。 |
| 403 | ft.Forbidden | API Key缺少当前操作权限 | 您无权限操作 | 使用具备本页操作权限的当前空间API Key。功能实际可用性请结合站点配置核对。 |