跳转至

修改



POST /api/v1/dashboard/{dashboard_uuid}/modify

概述

更新内置视图的名称、描述、标识或绑定条件。

调用前和使用步骤

先调用内置视图详情保存现有 dashboardBidding 和名称。省略 dashboardBidding 或提交空对象,都会删除原有绑定。只改名称等字段而要保留绑定时,也须提交详情返回的完整 dashboardBidding。修改后再用详情核对。

路由参数

参数名 类型 必选 说明
dashboard_uuid string Y 当前工作空间的内置视图 UUID。
例子: dsbd_inner_example
获取或填写方式: 从内置视图列表的 content.data[].uuid 获取,也可使用新建响应的 content.uuid。

请求头

参数名 类型 必选 说明
DF-API-KEY string Y 工作空间的 OpenAPI 鉴权凭据。
例子: <DF-API-KEY>
获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。

Body 请求参数

参数名 类型 必选 说明
dashboardBidding.* array 属性值为对应字段的匹配条件数组。
例子: [{"op": "in", "value": ["web-01"]}]
获取或填写方式: 用内置视图详情读取当前绑定,或从需要跳转到视图的日志、对象等数据中确认字段值。
dashboardBidding.*[].op string in 匹配给定值之一,wildcard 按通配模式匹配。来源字段值非空时,单独的 * 可匹配所有取值。多个条件按任意命中处理。
例子: in
获取或填写方式: 优先沿用详情中该字段的匹配方式。
dashboardBidding.*[].value array 字符串数组。空间限制左通配时,请避免使用 *example 形式。
例子: ["web-01"]
获取或填写方式: 从原始数据的该字段中选取实际值。如需匹配标签可用 label,匹配原始数据的 df_label。
name string 内置视图名称,最多 256 字符。
允许 null: False
最大长度: 256
例子: 主机详情内置视图
获取或填写方式: 填写当前工作空间中未被另一内置视图使用的名称。
desc string 内置视图描述,最多 2048 字符。
允许 null: False
最大长度: 2048
例子: 根据主机查看运行状态
获取或填写方式: 填写该视图的用途。
identifier string 同一工作空间的内置视图标识应唯一,最多 128 字符,可以为空。
允许 null: False
允许空字符串: True
最大长度: 128
例子: host-overview
获取或填写方式: 自定义稳定标识,修改前可通过详情获取当前 identifier。
dashboardBidding json 完整绑定条件,提交非空对象会整体替换;省略或传 {} 删除绑定。
允许 null: False
例子: {"host": [{"op": "in", "value": ["web-01"]}]}
获取或填写方式: 用内置视图详情读取当前绑定,或从需要跳转到视图的日志、对象等数据中确认字段值。

参数补充说明

更改标识时应同步依赖该标识的调用。保留绑定时请使用自己的详情结果替换示例值。

请求例子

curl --request POST 'https://openapi.guance.com/api/v1/dashboard/dsbd_inner_example/modify' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"主机详情内置视图 v2","dashboardBidding":{"host":[{"op":"in","value":["web-01"]}]}}'

响应

HTTP 200,application/json。下方示例展示可直接读取的主要字段。

字段 类型 说明
content.id integer 内置视图记录编号。
content.uuid string 内置视图 UUID。
content.workspaceUUID string 所属工作空间。
content.name string 内置视图名称。
content.desc string 内置视图描述。
content.identifier string 自定义标识,可为空。
content.ownerType string 内置视图资源归属,内置视图为 inner。
content.type string 内置视图类型,例如 CUSTOM。
content.isPublic integer 详情访问范围。1 为公开,0 为仅创建身份可访问。
content.chartPos array<object> 图表布局数组,含 chartUUID 和布局对象 pos。
content.chartPos[].chartUUID string 所引用的图表 UUID。
content.chartPos[].pos object 布局的位置及尺寸,如 x、y、w、h。
content.chartGroupPos array<string> 图表组排列顺序。
content.iconSet object 图标配置。
content.extend object 内置视图扩展信息。
content.mapping array<object> 变量字段映射信息。
content.dashboardBindSet array 视图绑定配置。
content.createdWay string 资源创建来源。
content.openPermissionSet boolean 实体记录的权限配置开关。
content.permissionSet array<string> 记录中的操作权限主体 UUID。
content.readPermissionSet array<string> 记录中的读取权限主体 UUID。
content.status integer 记录状态。
content.creator string 创建者身份 ID。
content.updator string 最近更新身份 ID,可为空。
content.createAt number 创建时间,Unix 秒。
content.updateAt number 更新时间,Unix 秒。未更新时可为 -1。
content.deleteAt number 删除时间,Unix 秒。未删除时为 -1。
content.creatorInfo object 创建身份信息,未查到时为空对象。
content.updatorInfo object 最近更新身份信息,未查到时为空对象。
content.creatorInfo.uuid string 查询到对应身份时可能提供。身份标识。
content.creatorInfo.status integer 查询到对应身份时可能提供。账号状态。
content.creatorInfo.wsAccountStatus integer 查询到对应身份时可能提供。工作空间成员状态。
content.creatorInfo.username string 查询到对应身份时可能提供。登录名。
content.creatorInfo.name string 查询到对应身份时可能提供。显示名称。
content.creatorInfo.iconUrl string 查询到对应身份时可能提供。头像 URL。
content.creatorInfo.email string 查询到对应身份时可能提供。账号邮箱。API Key 身份可能返回其标识。
content.creatorInfo.mobile string 查询到对应身份时可能提供。联系方式。
content.creatorInfo.countryCode string 查询到对应身份时可能提供。手机号国家或地区代码。
content.creatorInfo.acntWsNickname string 查询到对应身份时可能提供。空间内昵称。
content.updatorInfo.uuid string 查询到对应身份时可能提供。身份标识。
content.updatorInfo.status integer 查询到对应身份时可能提供。账号状态。
content.updatorInfo.wsAccountStatus integer 查询到对应身份时可能提供。工作空间成员状态。
content.updatorInfo.username string 查询到对应身份时可能提供。登录名。
content.updatorInfo.name string 查询到对应身份时可能提供。显示名称。
content.updatorInfo.iconUrl string 查询到对应身份时可能提供。头像 URL。
content.updatorInfo.email string 查询到对应身份时可能提供。账号邮箱。API Key 身份可能返回其标识。
content.updatorInfo.mobile string 查询到对应身份时可能提供。联系方式。
content.updatorInfo.countryCode string 查询到对应身份时可能提供。手机号国家或地区代码。
content.updatorInfo.acntWsNickname string 查询到对应身份时可能提供。空间内昵称。
content.old_name string 更新前的名称。
content.dashboardBidding object 绑定条件对象。无绑定时为空对象。
content.dashboardBidding.* array<object> 按实际来源字段组织的匹配条件数组。
content.dashboardBidding.*[].op string 匹配运算符。
content.dashboardBidding.*[].value array<string> 匹配值数组。
content.tagInfo array<object> 内置视图当前返回空数组。
content.declaration object 或 null 工作空间的公共声明。
{
  "code": 200,
  "content": {
    "id": 72,
    "uuid": "dsbd_inner_example",
    "name": "主机详情内置视图 v2",
    "desc": "根据主机查看运行状态",
    "workspaceUUID": "wksp_example",
    "identifier": "host-overview",
    "ownerType": "inner",
    "type": "CUSTOM",
    "isPublic": 1,
    "chartPos": [],
    "chartGroupPos": [],
    "iconSet": {},
    "extend": {},
    "mapping": [],
    "dashboardBindSet": [],
    "createdWay": "manual",
    "openPermissionSet": false,
    "permissionSet": [],
    "readPermissionSet": [],
    "status": 0,
    "creator": "wsak_example",
    "updator": "wsak_example",
    "createAt": 1785427200,
    "updateAt": 1785427320,
    "deleteAt": -1,
    "old_name": "主机详情内置视图",
    "dashboardBidding": {
      "host": [
        {
          "op": "in",
          "value": [
            "web-01"
          ]
        }
      ]
    },
    "tagInfo": [],
    "creatorInfo": {},
    "updatorInfo": {},
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

错误响应

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

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
406 ft.ParameterValidationFailed 字段类型、取值不符合声明或含未声明字段 参数解析失败 按参数表核对字段名、类型和长度。
400 ft.RequestJsonFormatError 请求 JSON 语法无效 请求 JSON 格式错误 按 content.reason、line、column 修正 JSON。
400 ft.JsonFormatError JSON 顶层不是对象 部分 json 文件格式错误 把字段放入单个 JSON 对象。
404 ft.NotFoundView 目标不存在、已删除或不属于此工作空间 未找到指定视图 从同一空间的内置视图列表获取仍有效的 UUID。
403 ft.ForbiddenOperationResource API Key 无目标视图的有效操作权限 暂无操作权限 确认工作空间归属和 API Key 权限,或联系资源创建者。
406 ft.ParameterCheckFailed 工作空间限制左通配,绑定值命中开头为 * 的通配条件 查询配置中模糊匹配暂不支持左*匹配 移除值开头的 * 或改用精确值。该限制适用于 wildcard 或字段名以 *、-* 开头的条件;单独 * 不触发此校验。错误响应的 content 为 true。
400 ft.IdentificationIdExists 标识已被同一工作空间中的其他内置视图占用 标识ID已存在 选择未使用的标识,或省略该字段保留原值。
400 ft.ObjectParmeterExists 新名称已被当前空间中的另一内置视图使用 {} 已存在 换用尚未使用的名称。

文档评价

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