统一目录实体创建¶
POST /api/v1/unified_catalog/entity/create
概述¶
创建统一目录实体。
Body 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| entityType | string | Y | 实体类型编码 允许为空: False 例子: database |
| name | string | Y | 实体名称 允许为空: False 例子: demo |
| attributes | json | 实体属性对象 允许为空: False 例子: {'project': 'demo', 'env': 'prod', 'custom_tags': ['mysql']} |
|
| telemetrySelectors | array | 关联查询信息配置 允许为空: False |
参数补充说明¶
请求参数说明
| 参数名 | type | 必选 | 说明 |
|---|---|---|---|
| entityType | string | 是 | 实体类型编码 |
| name | string | 是 | 实体名称 |
| attributes | json | 否 | 实体属性对象 |
| telemetrySelectors | array | 否 | 实体关联查询配置 |
attributes 常用扩展字段说明
| 字段名 | type | 说明 |
|---|---|---|
| depends_on | array[string] | 依赖关系,写入时会转为 links |
| component_of | array[string] | 归属关系,写入时会转为 contains |
| custom_tags | array/string | 自定义标签,若标签不存在会自动创建 |
| owner | string/array | 团队名称,后端会按团队名称解析团队信息 |
调用注意事项
- 关系字段统一放在
attributes中传入,不需要单独传 relations。 - 若传入
custom_tags,建议使用标签名数组。
请求例子¶
curl 'https://openapi.guance.com/api/v1/unified_catalog/entity/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"entityType":"database","name":"demo","attributes":{"project":"demo","env":"prod","component_of":["urn:system:default:core"]},"telemetrySelectors":[]}'