跳转至

统一目录拓扑实体字段定义



GET /api/v1/unified_catalog/topology/entity_fields

概述

读取当前空间可见类型的base与自定义字段定义。

调用前和使用步骤

传entityType返回该类型fields;省略/空串返回entityType=""、fields=[]及按类型组织的entityTypes,不是合并去重的一张字段表。单类型不存在通常返回[];host/service会附加保留entityStatus选项,因此非空也不能代替类型存在性验证,先查类型列表。

字段顺序base properties后接当前空间customProperties,再补entityType内建字段。host/service在未存在同名字段时补entityStatus(online/offline)。标题依据请求已解析语言选本地化值,返回文本不用作请求字段名。此页不返回全部Schema能力/枚举详情,完整编辑信息用类型详情原始YAML。相同编码优先当前空间配置,不读取其他空间自定义类型。

请求头

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

Query 请求参数

参数名 类型 必选 说明
entityType string 可选的单个实体类型编码;省略或空字符串查询全部类型的字段信息。不是实体类型UUID或显示名。
允许 null: True
例子: database
获取或填写方式: 从实体类型列表items[].entityType获取编码,不是类型UUID/显示名。

参数补充说明

请求参数说明

参数名 type 必选 说明
entityType string 否 实体类型编码

调用注意事项

  • entityType 不传或传空字符串时,返回当前工作空间下所有实体类型字段。
  • 若只需要某一类实体的字段定义,建议传入对应 entityType 缩小返回范围。

请求例子

curl --get 'https://openapi.guance.com/api/v1/unified_catalog/topology/entity_fields' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-urlencode entityType=database

响应

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

字段 类型 说明
content.entityType string 请求类型编码,全类型模式为空串。
content.fields array<object> 单类型字段数组;全类型模式固定[]。
content.fields[].key string 字段编码,后续fields/filters/groupByFields按各接口规则取用。
content.fields[].title string 本地化标题,UIView title优先于base标题,缺省回退字段名。
content.fields[].type string DataSchema字段类型,缺省string;合成entityStatus为enum。
content.fields[].required boolean 字段Schema必填标记,不代表当前查询接口必须填该属性。
content.fields[].systemReserved boolean 仅合成entityStatus存在且true。
content.fields[].options array<object> 仅合成entityStatus等返回的选项;普通字段不保证返回allowed_values全部配置。
content.fields[].options[].value string entityStatus为online/offline。
content.fields[].options[].label string 本地化选项文本。
content.entityTypes array<object> 仅全类型模式存在,按类型分别列字段。
content.entityTypes[].entityType string 当前可见类型编码。
content.entityTypes[].fields array<object> 该类型字段。
content.entityTypes[].fields[].key string 字段编码,后续fields/filters/groupByFields按各接口规则取用。
content.entityTypes[].fields[].title string 本地化标题,UIView title优先于base标题,缺省回退字段名。
content.entityTypes[].fields[].type string DataSchema字段类型,缺省string;合成entityStatus为enum。
content.entityTypes[].fields[].required boolean 字段Schema必填标记,不代表当前查询接口必须填该属性。
content.entityTypes[].fields[].systemReserved boolean 仅合成entityStatus存在且true。
content.entityTypes[].fields[].options array<object> 仅合成entityStatus等返回的选项;普通字段不保证返回allowed_values全部配置。
content.entityTypes[].fields[].options[].value string entityStatus为online/offline。
content.entityTypes[].fields[].options[].label string 本地化选项文本。
content.declaration object 或 null 非空业务对象附带的工作空间公共声明,未配置时可为null或空对象;空对象不添加。
{
  "code": 200,
  "content": {
    "entityType": "database",
    "fields": [
      {
        "key": "env",
        "title": "环境",
        "type": "string",
        "required": false
      },
      {
        "key": "entityType",
        "title": "实体类型",
        "type": "string",
        "required": true
      }
    ],
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

不传entityType时的成功结构:

{
  "code": 200,
  "content": {
    "entityType": "",
    "fields": [],
    "entityTypes": [
      {
        "entityType": "database",
        "fields": [
          {
            "key": "env",
            "title": "环境",
            "type": "string",
            "required": false
          },
          {
            "key": "entityType",
            "title": "实体类型",
            "type": "string",
            "required": true
          }
        ]
      }
    ],
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

错误响应

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

本接口只读类型定义,不查询实体数据。不存在的编码可返回空fields,不把字段数组为空当作404;历史YAML/metadata损坏或数据库异常可能500,保存traceId并由管理员核对类型原始定义。

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
406 ft.ParameterValidationFailed 请求字段缺失,或字段值违反声明的校验条件 参数解析失败 核对参数位置、字段名、类型和取值。
406 ft.InvalidParameter 当前空间customProperties字段与base字段冲突或字段YAML无效 参数{}无效 由管理员修正类型自定义字段,避免同名;读取参数本身正确时不要反复换字段名。
500 ft.InternalServerError 下游查询失败/超时、成功数据形状异常或标签/团队/时间格式化失败 内部错误 缩小查询范围后适当重试;持续失败保留traceId和筛选条件排查,不归因于本次写入。

文档评价

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