获取¶
GET /api/v1/role/{role_uuid}/get
概述¶
读取当前工作空间内指定角色的基本信息及权限标识。
调用前和使用步骤¶
先调用角色列表取角色 UUID。要把权限标识显示成名称时,可从权限列表读取目录。角色拥有的权限和当前 API Key 拥有的权限分别由不同调用决定。
从站点域名表选择所属站点的 OpenAPI 地址。
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| role_uuid | string | Y | 目标角色 UUID。 例子: role_example获取或填写方式: 从角色列表响应的 content.data[].uuid 取得。 |
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI Key 凭据。使用完整密钥值,不使用 API Key 记录的 UUID。 例子: <DF-API-KEY>获取或填写方式: 在目标工作空间的 API Key 管理中创建或获取具备本接口权限的 Key。 |
参数补充说明¶
工作空间由请求中的 DF-API-KEY 确定。
请求例子¶
curl --get -H "DF-API-KEY: <DF-API-KEY>" \
"https://openapi.guance.com/api/v1/role/role_example/get"
响应¶
HTTP 200,application/json。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.id | integer | 角色记录 ID。 |
| content.uuid | string | 角色 UUID;后续查询角色详情使用这个字段。 |
| content.name | string | 角色名称。 |
| content.desc | string | 角色描述。 |
| content.isSystem | integer | 1 表示系统内置角色,0 表示其他角色。 |
| content.workspaceUUID | string | 角色所属或应用到的空间;系统内置角色可为空。 |
| content.builtinRoleUUID | string | 管理后台内置角色模板 UUID,无模板时为空。 |
| content.isAllWorkspace | integer | 管理后台内置角色是否应用于所有工作空间,0 否,1 是。 |
| content.isManageBuiltinRole | boolean | 是否为通过管理后台定义并应用的内置角色。 |
| content.creator | string | 创建者标识。 |
| content.updator | string | 最后更新者标识。 |
| content.createAt | integer | 创建时间。 Unix 秒。 |
| content.updateAt | integer | 最后更新时间。 Unix 秒。 |
| content.deleteAt | integer | 删除时间,Unix 秒,未删除时为 -1。 |
| content.status | integer | 角色记录状态。 |
| content.creatorInfo | object | 创建者资料,查不到时为 {}。 |
| content.updatorInfo | object | 最后更新者资料,查不到时为 {}。 |
| content.permissions | array<string> |
当前角色的权限标识集合。 |
| content.declaration | object 或 null | 工作空间的公开声明数据,配置为空时可为 null。 |
{
"code": 200,
"content": {
"id": 101,
"uuid": "role_example",
"name": "日志只读",
"desc": "查询应用日志",
"isSystem": 0,
"workspaceUUID": "wksp_example",
"builtinRoleUUID": "",
"isAllWorkspace": 0,
"isManageBuiltinRole": false,
"status": 0,
"creatorInfo": {},
"updatorInfo": {},
"permissions": [
"routine.defaultAccess"
],
"declaration": null
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 404 | ft.NotFoundRole | 对应角色不存在、已删除或在当前空间不可用 | 未找到指定角色或角色已被删除。 | 重新查询当前空间的角色列表,使用实际返回的 uuid。 |