Skip to content

更新机密信息元数据

更新机密信息的展示信息、责任人、标签、扩展元数据或启用状态,不修改机密值。

更新于 查看 Markdown
PATCH/api/v1/secret/{resource_path...}
使用 App Header 签名或 App Secret需要 unsealed

Path 参数

resource_path必填

string

机密信息路径,并在末尾追加 /metadata

示例:"production/orders/database/metadata"

Body 参数

contact_email可选

string

联系人邮箱

示例:"owner@example.com"

contact_name可选

string

联系人姓名

示例:"张三"

contact_phone可选

string

联系人电话

示例:"13800000000"

department可选

string

所属部门

示例:"平台工程部"

description可选

string

用途说明

示例:"生产订单服务连接数据库使用"

labels可选

object

用于检索和归类的标签

示例:{"environment":"production"}

metadata可选

object

面向外部集成的非敏感扩展元数据

示例:{"ticket":"SEC-1001"}

name可选

string

展示名称

示例:"订单数据库凭据"

organization可选

string

所属机构

示例:"示例科技"

status可选

string

资源状态:active 或 disabled

示例:"active"

成功响应

HTTP 200

返回更新后的机密信息元数据

{
  "data": {
    "item": {
      "contact_email": "owner@example.com",
      "contact_name": "张三",
      "contact_phone": "13800000000",
      "created_at": "2026-08-01T08:00:00Z",
      "created_by": "app_orders",
      "current_version": 3,
      "department": "平台工程部",
      "description": "生产订单服务连接数据库使用",
      "labels": {
        "environment": "production"
      },
      "metadata": {
        "ticket": "SEC-1001"
      },
      "name": "订单数据库凭据",
      "organization": "示例科技",
      "path": "production/orders/database",
      "status": "active",
      "updated_at": "2026-08-02T08:00:00Z",
      "updated_by": "app_orders",
      "version": 2
    }
  },
  "error": null,
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

失败响应

按 HTTP status 和 error.code 区分失败原因;响应始终使用统一 envelope。

HTTP 400 · invalid_request

请求参数或 JSON 请求体无效

{
  "data": null,
  "error": {
    "code": "invalid_request",
    "details": {},
    "message": "请求参数或 JSON 请求体无效"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 400 · not_initialized

系统尚未初始化

{
  "data": null,
  "error": {
    "code": "not_initialized",
    "details": {},
    "message": "系统尚未初始化"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 401 · replayed_request

签名请求的 nonce 已被使用

{
  "data": null,
  "error": {
    "code": "replayed_request",
    "details": {},
    "message": "签名请求的 nonce 已被使用"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 401 · unauthorized

App ID、App Secret 或签名无效,或者凭据已过期

{
  "data": null,
  "error": {
    "code": "unauthorized",
    "details": {},
    "message": "App ID、App Secret 或签名无效,或者凭据已过期"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 403 · forbidden

App 没有访问目标资源所需的权限

{
  "data": null,
  "error": {
    "code": "forbidden",
    "details": {},
    "message": "App 没有访问目标资源所需的权限"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 404 · not_found

机密信息不存在

{
  "data": null,
  "error": {
    "code": "not_found",
    "details": {},
    "message": "机密信息不存在"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 409 · conflict

机密信息路径或当前状态发生冲突

{
  "data": null,
  "error": {
    "code": "conflict",
    "details": {},
    "message": "机密信息路径或当前状态发生冲突"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 413 · request_body_too_large

请求体超过服务端限制

{
  "data": null,
  "error": {
    "code": "request_body_too_large",
    "details": {},
    "message": "请求体超过服务端限制"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 423 · sealed

系统处于封印状态

{
  "data": null,
  "error": {
    "code": "sealed",
    "details": {},
    "message": "系统处于封印状态"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 500 · internal_error

服务端无法完成请求

{
  "data": null,
  "error": {
    "code": "internal_error",
    "details": {},
    "message": "服务端无法完成请求"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 503 · leader_unavailable

高可用集群的 Leader 暂不可用

{
  "data": null,
  "error": {
    "code": "leader_unavailable",
    "details": {},
    "message": "高可用集群的 Leader 暂不可用"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}

HTTP 503 · maintenance_mode

系统处于维护模式

{
  "data": null,
  "error": {
    "code": "maintenance_mode",
    "details": {},
    "message": "系统处于维护模式"
  },
  "request_id": "019fb18d-6b45-7e2d-a3b4-c5d6e7f80910"
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close