列出¶
GET /api/v1/viewer/list
概述¶
分页列出当前工作空间内可见的查看器。
调用前和使用步骤¶
可组合名称、标签和过滤范围。默认先列收藏,再按更新时间降序(未更新时间时用创建时间)。显式 sortKey 时按指定字段排序。取得 content.data[].uuid 后可查查看器详情。没有结果时列表为空。
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI 鉴权凭据。 例子: <DF-API-KEY>获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。 |
Query 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| sortKey | string | 省略时使用默认排序。显式选择字段时按字段排序。 允许 null: False 允许空字符串: True 可选值: ['name', 'updateAt'] 例子: updateAt获取或填写方式: 按显示需要从 name 或 updateAt 中选择。 |
|
| sortMethod | string | 排序方向,默认 desc。 允许 null: False 允许空字符串: True 可选值: ['desc', 'asc'] 例子: desc获取或填写方式: 升序传 asc,降序传 desc。无需控制时省略。 |
|
| search | string | 按名称包含匹配,省略或空白不过滤名称。 允许 null: False 例子: 巡检获取或填写方式: 从已有查看器的名称选取关键词。 |
|
| pageIndex | integer | 页码,默认 1。 允许 null: False $minValue: 1 例子: 1获取或填写方式: 页面从 1 开始。 |
|
| pageSize | integer | 单页数量,默认 50,范围 1 至 100。 允许 null: False $minValue: 1 $maxValue: 100 例子: 20获取或填写方式: 按单页所需数量填写。 |
|
| filter | string | 默认 total。total 全部可见;favorite 收藏;import 导入来源;myCreate 当前身份创建;oftenBrowse 最近常看,兼容 ofenBrowse;selfVisibleOnly 当前身份的私有查看器。 允许 null: False 可选值: ['total', 'favorite', 'import', 'myCreate', 'oftenBrowse', 'ofenBrowse', 'selfVisibleOnly'] 例子: total获取或填写方式: 按需要从参数描述中的过滤值选择。 |
|
| tagNames | json | 按任一标签名匹配。 允许 null: False 例子: ["team:ops"]获取或填写方式: 从详情的 content.tagInfo[].name 选取标签,组成 JSON 字符串数组并 URL 编码。 |
参数补充说明¶
分页信息位于响应顶层。Query 的 tagNames 用 JSON 字符串数组表达。
请求例子¶
curl --get 'https://openapi.guance.com/api/v1/viewer/list' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-urlencode 'search=巡检' \
--data-urlencode pageIndex=1 \
--data-urlencode pageSize=20 \
--data-urlencode sortKey=updateAt \
--data-urlencode sortMethod=desc
响应¶
HTTP 200,application/json。下方示例展示可直接读取的主要字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.data | array<object> |
当前页的查看器对象。 |
| content.data[].id | integer | 查看器记录编号。 |
| content.data[].uuid | string | 查看器 UUID。 |
| content.data[].workspaceUUID | string | 所属工作空间。 |
| content.data[].name | string | 查看器名称。 |
| content.data[].desc | string | 查看器描述。 |
| content.data[].identifier | string | 自定义标识,可为空。 |
| content.data[].ownerType | string | 查看器资源归属,通常为 viewer。 |
| content.data[].type | string | 查看器类型,例如 CUSTOM。 |
| content.data[].isPublic | integer | 当前资源的可见范围。1 为公开,0 为仅创建身份可见。 |
| content.data[].chartPos | array<object> |
图表布局数组,含 chartUUID 和布局对象 pos。 |
| content.data[].chartPos[].chartUUID | string | 所引用的图表 UUID。 |
| content.data[].chartPos[].pos | object | 布局的位置及尺寸,如 x、y、w、h。 |
| content.data[].chartGroupPos | array<string> |
图表组排列顺序。 |
| content.data[].iconSet | object | 图标配置。 |
| content.data[].extend | object | 查看器扩展信息。 |
| content.data[].mapping | array<object> |
变量字段映射信息。 |
| content.data[].dashboardBindSet | array | 视图绑定配置。 |
| content.data[].createdWay | string | 资源创建来源。 |
| content.data[].openPermissionSet | boolean | 实体记录的权限配置开关。 |
| content.data[].permissionSet | array<string> |
记录中的操作权限主体 UUID。 |
| content.data[].readPermissionSet | array<string> |
记录中的读取权限主体 UUID。 |
| content.data[].tagInfo | array<object> |
关联标签信息。 |
| content.data[].tagInfo[].id | string | 与标签 UUID 相同的标识。 |
| content.data[].tagInfo[].uuid | string | 标签 UUID。 |
| content.data[].tagInfo[].name | string | 标签名称。 |
| content.data[].tagInfo[].description | string | 标签描述。 |
| content.data[].tagInfo[].colour | string | 标签颜色。 |
| content.data[].tagInfo[].scope | array<string> |
标签生效作用域。 |
| content.data[].tagInfo[].tagPermissionInfo | object | 存在时为读写授权信息。 |
| content.data[].status | integer | 记录状态。 |
| content.data[].creator | string | 创建者身份 ID。 |
| content.data[].updator | string | 最近更新身份 ID,可为空。 |
| content.data[].createAt | number | 创建时间,Unix 秒。 |
| content.data[].updateAt | number | 更新时间,Unix 秒。未更新时可为 -1。 |
| content.data[].deleteAt | number | 删除时间,Unix 秒。未删除时为 -1。 |
| content.data[].creatorInfo | object | 创建身份信息,未查到时为空对象。 |
| content.data[].updatorInfo | object | 最近更新身份信息,未查到时为空对象。 |
| content.data[].creatorInfo.uuid | string | 查询到对应身份时可能提供。身份标识。 |
| content.data[].creatorInfo.status | integer | 查询到对应身份时可能提供。账号状态。 |
| content.data[].creatorInfo.wsAccountStatus | integer | 查询到对应身份时可能提供。工作空间成员状态。 |
| content.data[].creatorInfo.username | string | 查询到对应身份时可能提供。登录名。 |
| content.data[].creatorInfo.name | string | 查询到对应身份时可能提供。显示名称。 |
| content.data[].creatorInfo.iconUrl | string | 查询到对应身份时可能提供。头像 URL。 |
| content.data[].creatorInfo.email | string | 查询到对应身份时可能提供。账号邮箱。API Key 身份可能返回其标识。 |
| content.data[].creatorInfo.mobile | string | 查询到对应身份时可能提供。联系方式。 |
| content.data[].creatorInfo.countryCode | string | 查询到对应身份时可能提供。手机号国家或地区代码。 |
| content.data[].creatorInfo.acntWsNickname | string | 查询到对应身份时可能提供。空间内昵称。 |
| content.data[].updatorInfo.uuid | string | 查询到对应身份时可能提供。身份标识。 |
| content.data[].updatorInfo.status | integer | 查询到对应身份时可能提供。账号状态。 |
| content.data[].updatorInfo.wsAccountStatus | integer | 查询到对应身份时可能提供。工作空间成员状态。 |
| content.data[].updatorInfo.username | string | 查询到对应身份时可能提供。登录名。 |
| content.data[].updatorInfo.name | string | 查询到对应身份时可能提供。显示名称。 |
| content.data[].updatorInfo.iconUrl | string | 查询到对应身份时可能提供。头像 URL。 |
| content.data[].updatorInfo.email | string | 查询到对应身份时可能提供。账号邮箱。API Key 身份可能返回其标识。 |
| content.data[].updatorInfo.mobile | string | 查询到对应身份时可能提供。联系方式。 |
| content.data[].updatorInfo.countryCode | string | 查询到对应身份时可能提供。手机号国家或地区代码。 |
| content.data[].updatorInfo.acntWsNickname | string | 查询到对应身份时可能提供。空间内昵称。 |
| content.data[].isFavorite | boolean | 当前身份收藏状态。详情未收藏时可不返回。 |
| content.data[].isIndexDashboard | boolean | 是否为当前空间的首页视图。 |
| content.data[].refCheckerUUIDs | array<string> |
关联的监控器标识。 |
| content.declaration | object 或 null | 工作空间的公共声明。 |
| pageInfo | object | 响应顶层的分页对象。 |
| pageInfo.pageIndex | integer | 当前页码。 |
| pageInfo.pageSize | integer | 每页数量。 |
| pageInfo.count | integer | 本页条数。 |
| pageInfo.totalCount | integer | 匹配记录总数,当前实现可能在空页回 0。 |
{
"code": 200,
"content": {
"data": [
{
"id": 25,
"uuid": "dsbd_view_example",
"name": "主机巡检查看器",
"desc": "主机巡检与状态核对",
"workspaceUUID": "wksp_example",
"identifier": "",
"ownerType": "viewer",
"type": "CUSTOM",
"isPublic": 1,
"chartPos": [],
"chartGroupPos": [],
"iconSet": {},
"extend": {},
"mapping": [],
"dashboardBindSet": [],
"createdWay": "manual",
"openPermissionSet": false,
"permissionSet": [],
"readPermissionSet": [],
"tagInfo": [],
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"creatorInfo": {},
"updatorInfo": {},
"isFavorite": false,
"isIndexDashboard": false,
"refCheckerUUIDs": []
}
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE",
"pageInfo": {
"pageIndex": 1,
"pageSize": 20,
"count": 1,
"totalCount": 1
}
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 使用未声明的 Query 参数或参数违反规则 | 参数解析失败 | 核对 Query 参数表及示例。 |
| 500 | ft.InternalServerError | tagNames 解析失败、分页不能转整数或排序方式无法被控制器处理 | 内部错误 | 按示例传入编码后的 JSON 数组字符串,确保分页为整数,排序方式只用 asc 或 desc。 |