跳转至

列出



GET /api/v1/service_manage/list

概述

分页列出工作空间内的服务清单配置。

调用前和使用步骤

先按名称或类型筛选,再使用 content.data[].uuid 调用服务清单详情。多种筛选同时提供时取交集,同一逗号分隔字段内的选项按任一匹配。默认收藏置顶,其余按创建时间降序。逐页读取响应顶层 pageInfo;loading=true时服务状态缓存仍在准备,dfStatus默认ok不能据此确认采集或监控已正常。

请求头

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

Query 请求参数

参数名 类型 必选 说明
search string 按服务名称包含匹配,省略或空白时不按名称过滤。
允许 null: False
例子: checkout
获取或填写方式: 填写已知服务名称中的关键词。
originStr string 配置返回格式。默认 1,serviceCatelog 为 TOML 字符串;0 为解析后的对象。服务端按整数读取,使用 0 或 1。
允许 null: False
例子: 0
获取或填写方式: 需要由程序读取配置时传字符串 0,保留 TOML 原文时传字符串 1。
filter string 总列表、当前身份收藏、当前身份创建或近期常看。省略为总列表。
允许 null: False
可选值: ['total', 'favorite', 'myCreate', 'oftenBrowse']
例子: total
获取或填写方式: 按目标范围选择 total、favorite、myCreate 或 oftenBrowse。
createType commaArray manual为账号创建,openapi为API Key创建,automatic为自动发现。
允许 null: False
例子: openapi,manual
获取或填写方式: 从列表项 createType 中选取一个或多个值,用英文逗号连接。
serviceType commaArray 服务分类筛选,例如app、framework、cache、message_queue、custom、db、web、aws_lambda。
允许 null: False
例子: web,app
获取或填写方式: 从列表项 type 中取值,用英文逗号连接。
teamUUID commaArray 按所属团队筛选,填写团队UUID。无匹配团队时返回空列表。
允许 null: False
例子: group_example
获取或填写方式: 从团队列表取得团队UUID;多个UUID用英文逗号连接。
pageIndex integer 页码,默认1,最小1。
允许 null: False
$minValue: 1
例子: 1
获取或填写方式: 从1开始,按返回的pageInfo推进下一页。
pageSize integer 每页条数,默认50,范围1至100。
允许 null: False
$minValue: 1
$maxValue: 100
例子: 20
获取或填写方式: 按客户端显示数量选择,每次不超过100。

参数补充说明

originStr=0时配置作为对象返回,示例采用此形式。没有匹配服务时data为空,pageInfo.count与totalCount均为0,loading可省略。

请求例子

curl --get 'https://openapi.guance.com/api/v1/service_manage/list' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-urlencode originStr=0 \
  --data-urlencode search=checkout \
  --data-urlencode pageIndex=1 \
  --data-urlencode pageSize=20

响应

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

字段 类型 说明
content object 列表数据与自动发现状态。
content.automaticFoundTime string 或 null 最近一次自动发现任务的开始时间,Unix秒字符串;尚无缓存时可为空。
content.loading boolean 状态缓存是否仍在准备;没有服务结果时可省略。
content.data array<object> 当前页的服务清单。
content.data[].uuid string 服务清单 UUID,后续用于详情、修改和删除。
content.data[].service string 服务名称,绑定链路数据中的 service。
content.data[].type string 服务分类。
content.data[].colour string 服务显示颜色。
content.data[].language string 服务语言标识,可能为空字符串。
content.data[].createAt number 创建时间,Unix秒。
content.data[].updateAt 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[].serviceCatelog string 或 object originStr=1 返回TOML字符串,originStr=0返回下列配置对象。
content.data[].serviceCatelog.Team object 服务及团队配置。
content.data[].serviceCatelog.Team.service string 服务名称。
content.data[].serviceCatelog.Team.type string 服务分类,写入时按接口规则处理无效分类。
content.data[].serviceCatelog.Team.colour string 服务显示颜色。
content.data[].serviceCatelog.Team.team string 所属团队名称。
content.data[].serviceCatelog.Team.oncall array<object> 联系方式。
content.data[].serviceCatelog.Team.oncall[].name string 联系方式显示名称。
content.data[].serviceCatelog.Team.oncall[].type string email、mobile或slack。
content.data[].serviceCatelog.Team.oncall[].emails array<string> email联系方式的邮箱地址。
content.data[].serviceCatelog.Team.oncall[].mobiles array<string> mobile联系方式的电话号码。
content.data[].serviceCatelog.Team.oncall[].slack string Slack频道地址。
content.data[].serviceCatelog.Repos array<object> 代码仓库列表。
content.data[].serviceCatelog.Repos[].name string 仓库显示名称。
content.data[].serviceCatelog.Repos[].link string 仓库URL。
content.data[].serviceCatelog.Repos[].provider string 提供商显示名称。
content.data[].serviceCatelog.Docs array<object> 操作文档列表。
content.data[].serviceCatelog.Docs[].name string 文档显示名称。
content.data[].serviceCatelog.Docs[].link string 文档URL。
content.data[].serviceCatelog.Docs[].provider string 文档提供方显示名称。
content.data[].serviceCatelog.Related object 关联的应用、内置视图和场景标签。
content.data[].serviceCatelog.Related.AppId string 用户访问监测应用ID,可为空。
content.data[].serviceCatelog.Related.DashboardUUIDs array<string> 关联的内置视图UUID。
content.data[].serviceCatelog.Related.Tags array<string> 场景标签名称。
content.data[].dfStatus string 关联事件状态;缓存未准备或无状态时默认ok。
content.data[].isFavorite boolean 是否被当前调用身份收藏。
content.data[].createType string 按创建身份推导的来源。常见manual、openapi、automatic;历史其他身份可省略此字段。
content.declaration object 或 null 工作空间公共声明。
pageInfo object 响应顶层分页信息。
pageInfo.pageIndex integer 当前页码。
pageInfo.pageSize integer 每页大小。
pageInfo.count integer 当前页返回条数。
pageInfo.totalCount integer 满足筛选条件的总条数。
{
  "code": 200,
  "content": {
    "automaticFoundTime": "1785427200",
    "data": [
      {
        "uuid": "sman_example",
        "createAt": 1785427200,
        "updateAt": -1,
        "creatorInfo": {},
        "colour": "#40C9C9",
        "updatorInfo": {},
        "dfStatus": "ok",
        "language": "",
        "isFavorite": false,
        "createType": "openapi",
        "service": "checkout",
        "type": "web",
        "serviceCatelog": {
          "Team": {
            "service": "checkout",
            "type": "web",
            "team": "team-commerce",
            "colour": "#40C9C9",
            "oncall": [
              {
                "name": "值班邮箱",
                "type": "email",
                "emails": [
                  "xxx@guance.com"
                ]
              }
            ]
          },
          "Repos": [
            {
              "name": "业务仓库",
              "link": "https://example.invalid/repos/checkout",
              "provider": "Git"
            }
          ],
          "Docs": [
            {
              "name": "操作手册",
              "link": "https://example.invalid/help/checkout",
              "provider": "Wiki"
            }
          ],
          "Related": {
            "AppId": "",
            "Tags": [
              "team:commerce"
            ],
            "DashboardUUIDs": []
          }
        }
      }
    ],
    "loading": false,
    "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 originStr无法转换为整数 内部错误 使用字符串 0 或 1;记录 traceId 以便定位。

文档评价

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