跳转至

获取



GET /api/v1/workspace/accesskey/{ak_uuid}/get

概述

按记录 UUID 读取当前工作空间内指定 API Key 的资料和授权。

调用前和使用步骤

调用需要当前工作空间的 workspace.openAPIKeyManage 权限。下方示例节选常用字段。 从API Key 列表的 content[].uuid 取记录 UUID。手工创建且未绑定账号的工作空间 Key,可由空间 Owner 读取完整凭据。非 Owner 仅对本次使用的这条 Key 读到完整值,其他记录会掩码;个人、Agent 等其他来源也会掩码。请对日志和工单中的响应做脱敏。

路由参数

参数名 类型 必选 说明
ak_uuid string Y 目标记录 UUID,不能填实际 Secret Key。
例子: wsak_example
获取或填写方式: 从 API Key 列表的 content[].uuid 获取。

请求头

参数名 类型 必选 说明
DF-API-KEY string Y 工作空间调用凭据。记录 UUID 与调用凭据是不同字段。
例子: <DF-API-KEY>
获取或填写方式: 从当前工作空间 API Key 管理取得完整凭据。

参数补充说明

示例中的资源标识为占位值,请替换为目标工作空间的实际值。

请求例子

curl --get -H "DF-API-KEY: <DF-API-KEY>" \
  'https://openapi.guance.com/api/v1/workspace/accesskey/wsak_example/get'

响应

HTTP 200,application/json。

字段 类型 说明
content.uuid string API Key 记录的 UUID,常见前缀 wsak_。用于 API Key 管理接口的路径。
content.name string API Key 的名称。
content.workspaceUUID string 所属工作空间。
content.createdWay string API Key 的创建来源。
content.remark string API Key 的备注。
content.isOwnerRole integer 或 boolean 该 API Key 是否具备空间拥有者角色。
content.callCount integer 记录的调用次数。
content.lastCallAt integer 最近一次记录的调用时间,Unix 秒,无记录可为 -1。
content.createAt integer 记录创建时间,Unix 秒。
content.accountUUID string 显式绑定的账号 UUID,未绑定为空字符串。
content.effectiveAccountUUID string 鉴权使用的身份标识。未绑定时为该 API Key 记录 UUID。
content.accountInfo object 或 null 绑定账号资料,未绑定时为 null。
content.roles array<object> 有效角色集合,顺序不固定。
content.roles[].uuid string 角色 UUID。
content.roles[].name string 角色名称。
content.permissions array<string> 有效权限标识集合,顺序不固定。
content.rolePermissions object 各角色拥有的权限标识,以角色 UUID 为键,权限字符串数组为值。
content.declaration object 或 null 工作空间声明。
content.ak string Access Key 标识。可能按当前身份掩码。
content.sk string Secret Key 凭据。可能按当前身份掩码。应按敏感信息处理响应。
content.creatorInfo object 创建者资料,查不到时为空对象。
{
  "code": 200,
  "content": {
    "uuid": "wsak_example",
    "name": "应用数据读取",
    "workspaceUUID": "wksp_example",
    "createdWay": "manual",
    "remark": "",
    "isOwnerRole": 0,
    "callCount": 14,
    "lastCallAt": 1785427200,
    "createAt": 1785423600,
    "accountUUID": "",
    "effectiveAccountUUID": "wsak_example",
    "accountInfo": null,
    "roles": [
      {
        "uuid": "role_example",
        "name": "应用数据只读"
      }
    ],
    "permissions": [
      "routine.defaultAccess"
    ],
    "rolePermissions": {
      "role_example": [
        "routine.defaultAccess"
      ]
    },
    "declaration": null,
    "ak": "*************abcd",
    "sk": "*************ef01",
    "creatorInfo": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

错误响应

鉴权、限流和公共请求错误参见公共错误定义。

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
404 ft.AKNotExistOrDelete 同一空间内没有匹配的有效、非系统 API Key API Key 不存在或已删除。 使用当前空间列表返回的 UUID。
403 ft.Forbidden 非 Owner 试图读取 Owner Key 没有操作权限。 使用符合授权要求的调用身份。
403 ft.AgentMemberDisabled API Key 绑定的账号被停用 绑定账号不可用。 检查所绑定账号是否处于可用状态。
404 ft.AgentMemberNotFound API Key 绑定的账号不存在或已删除 找不到绑定账号。 核对绑定关系和账号状态。
404 ft.WorkspaceAgentMemberNotFound 绑定账号没有有效的工作空间成员关系 找不到对应的工作空间成员。 检查该账号是否仍为当前空间成员。

文档评价

文档内容是否对您有帮助?