跳转至

导出



GET /api/v1/service_manage/export

概述

导出当前工作空间的服务清单配置为JSON。

调用前和使用步骤

按originStr选择配置文本或对象。服务端固定取第一页、每页10000条。成功响应根节点直接为服务对象数组,保存完整响应后由客户端读取;超过10000条的完整遍历请使用列表接口分页。当空间没有服务清单时,根节点返回包含data和pageInfo的空集合对象。

请求头

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

Query 请求参数

参数名 类型 必选 说明
originStr string 配置返回格式。默认 1,serviceCatelog 为 TOML 字符串;0 为解析后的对象。服务端按整数读取,使用 0 或 1。
允许 null: False
例子: 0
获取或填写方式: 需要由程序读取配置时传字符串 0,保留 TOML 原文时传字符串 1。

参数补充说明

Content-Type为application/json。originStr=0的示例返回结构化配置。导出的服务字段和列表相同,当前导出上限为10000条。

请求例子

curl --get 'https://openapi.guance.com/api/v1/service_manage/export' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-urlencode originStr=0

响应

HTTP 200,Content-Type为application/json。下方示例为响应根节点,按数组或空集合对象读取。

字段 类型 说明
$ 对象数组或对象 有数据时为服务对象数组,空集合时为下述分页对象。
[].uuid string 服务清单 UUID,后续用于详情、修改和删除。
[].service string 服务名称,绑定链路数据中的 service。
[].type string 服务分类。
[].colour string 服务显示颜色。
[].language string 服务语言标识,可能为空字符串。
[].createAt number 创建时间,Unix秒。
[].updateAt number 更新时间,Unix秒;尚未更新时可为 -1。
[].creatorInfo object 创建身份资料,未查到时为空对象。
[].updatorInfo object 最近更新身份资料,未查到时为空对象。
[].creatorInfo.uuid string 查询到该身份时可能提供。身份标识。
[].creatorInfo.status integer 查询到该身份时可能提供。账号状态。
[].creatorInfo.wsAccountStatus integer 查询到该身份时可能提供。工作空间成员状态。
[].creatorInfo.username string 查询到该身份时可能提供。登录名称。
[].creatorInfo.name string 查询到该身份时可能提供。显示名称。
[].creatorInfo.iconUrl string 查询到该身份时可能提供。头像URL。
[].creatorInfo.email string 查询到该身份时可能提供。账号邮箱。API Key 身份可能返回其标识。
[].creatorInfo.mobile string 查询到该身份时可能提供。联系方式。
[].creatorInfo.countryCode string 查询到该身份时可能提供。电话国家或地区代码。
[].creatorInfo.acntWsNickname string 查询到该身份时可能提供。空间内昵称。
[].updatorInfo.uuid string 查询到该身份时可能提供。身份标识。
[].updatorInfo.status integer 查询到该身份时可能提供。账号状态。
[].updatorInfo.wsAccountStatus integer 查询到该身份时可能提供。工作空间成员状态。
[].updatorInfo.username string 查询到该身份时可能提供。登录名称。
[].updatorInfo.name string 查询到该身份时可能提供。显示名称。
[].updatorInfo.iconUrl string 查询到该身份时可能提供。头像URL。
[].updatorInfo.email string 查询到该身份时可能提供。账号邮箱。API Key 身份可能返回其标识。
[].updatorInfo.mobile string 查询到该身份时可能提供。联系方式。
[].updatorInfo.countryCode string 查询到该身份时可能提供。电话国家或地区代码。
[].updatorInfo.acntWsNickname string 查询到该身份时可能提供。空间内昵称。
[].serviceCatelog string 或 object originStr=1 返回TOML字符串,originStr=0返回下列配置对象。
[].serviceCatelog.Team object 服务及团队配置。
[].serviceCatelog.Team.service string 服务名称。
[].serviceCatelog.Team.type string 服务分类,写入时按接口规则处理无效分类。
[].serviceCatelog.Team.colour string 服务显示颜色。
[].serviceCatelog.Team.team string 所属团队名称。
[].serviceCatelog.Team.oncall array<object> 联系方式。
[].serviceCatelog.Team.oncall[].name string 联系方式显示名称。
[].serviceCatelog.Team.oncall[].type string email、mobile或slack。
[].serviceCatelog.Team.oncall[].emails array<string> email联系方式的邮箱地址。
[].serviceCatelog.Team.oncall[].mobiles array<string> mobile联系方式的电话号码。
[].serviceCatelog.Team.oncall[].slack string Slack频道地址。
[].serviceCatelog.Repos array<object> 代码仓库列表。
[].serviceCatelog.Repos[].name string 仓库显示名称。
[].serviceCatelog.Repos[].link string 仓库URL。
[].serviceCatelog.Repos[].provider string 提供商显示名称。
[].serviceCatelog.Docs array<object> 操作文档列表。
[].serviceCatelog.Docs[].name string 文档显示名称。
[].serviceCatelog.Docs[].link string 文档URL。
[].serviceCatelog.Docs[].provider string 文档提供方显示名称。
[].serviceCatelog.Related object 关联的应用、内置视图和场景标签。
[].serviceCatelog.Related.AppId string 用户访问监测应用ID,可为空。
[].serviceCatelog.Related.DashboardUUIDs array<string> 关联的内置视图UUID。
[].serviceCatelog.Related.Tags array<string> 场景标签名称。
[].dfStatus string 关联事件状态,未加载或无值时默认ok。
[].isFavorite boolean 当前身份收藏状态。
[].createType string 创建来源,可为manual、openapi、automatic;其他身份可能省略。
automaticFoundTime string 或 null 空集合对象中的最近自动发现任务时间。
data array<object> 空集合分支为[]。
pageInfo object 空集合分支的分页信息,pageIndex=1、pageSize=10000。
pageInfo.pageIndex integer 当前页码。
pageInfo.pageSize integer 每页大小。
pageInfo.count integer 当前页返回条数。
pageInfo.totalCount integer 满足筛选条件的总条数。
响应头 类型 说明
Content-Type string 成功时为application/json。
[
  {
    "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": []
      }
    }
  }
]

没有服务配置时的HTTP 200响应

{
  "automaticFoundTime": null,
  "data": [],
  "pageInfo": {
    "pageIndex": 1,
    "pageSize": 10000,
    "count": 0,
    "totalCount": 0
  }
}

错误响应

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

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
406 ft.ParameterValidationFailed 使用未声明的 Query 参数或参数违反规则 参数解析失败 核对 Query 参数表及示例。
500 ft.InternalServerError originStr无法转换为整数 内部错误 使用字符串 0 或 1;记录 traceId 以便定位。

文档评价

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