Import Entity by JSON

通用的导入数据对象接口,导入数据类型支持 FileSet、Measure、自定义类型

请求格式

POST https://{apigw-address}/data-catalog/v2.0/entities/import

请求参数(URI)

名称 位置(Path/Query) 必需/可选 数据类型 描述
orgId Query 必需 String 组织 ID
checkFlag Query 可选 boolean 是否开启规则校验(默认为 false,即不开启)

请求参数(Body)

名称 必需/可选 数据类型 描述
objects 必需 jsonArray 导入的数据对象列表

objects

名称 必需/可选 数据类型 描述
typeId 必需 String 类型标识符,导入数据类型支持:FileSet、Measure、自定义类型
attributes 必需 json 数据对象属性,以 json 的形式表示 <key,value>键值对,key 的值根据类型标识符所表示的具体类型定义来确定,key 的类型为String,value 的类型根据类型标识符所表示的具体类型定义来确定
tags 可选 jsonArray 关联的标签
terms 可选 jsonArray 关联的业务术语

tags

名称 必需/可选 数据类型 描述
tagId 可选 String 标签 ID
atrributes 可选 json 标签的属性Tag,以 json 的形式表示 <key,value> 键值对,key 的值根据类型标识符所表示的具体类型定义来确定,key 的类型为String,value 的类型根据类型标识符所表示的具体类型定义来确定

terms

名称 必需/可选 数据类型 描述
termId 可选 String 术语 ID

响应参数

data:null

示例

请求示例

url:    https://{apigw-address}/data-catalog/v2.0/entities/import?orgId=yourOrgId&checkFlag=false

method: POST

Content-Type: application/json

{
    "objects": [{
        "typeId": "FileSet",
        "attributes": {
            "id": "fsr",
            "name": "fdsfa",
            "description": "",
            "filePattern": [{
                "sourceId": "-1",
                "sourceType": "S3",
                "pattern": "fsdf",
                "sourceName": "yourSourcName"
            }],
            "fileType": "Tracelog File"
        },
        "tags": [{
            "tagId": "test:test",
            "attributes": {
                "attr_name": "attr_value"
            }
        }],
        "terms": [{
            "termId": "test:test2"
        }]
    }, {
        "typeId": "Measure",
        "attributes": {
            "id": "kiuy",
            "i18nName": {
                "default": "yourName",
                "zh_CN": "中文名字",
                "en_US": "",
                "es_ES": "",
                "ja_JP": ""
            },
            "dataType": "INT",
            "unit": "m"
        },
        "tags": [{
            "tagId": "test:test",
            "attributes": {
                "attr_name": "attr_value"
            }
        }],
        "terms": [{
            "termId": "test:test2"
        }]
    }, {
        "typeId": "UD_test2",
        "attributes": {
            "siteId": "ffff",
            "name": "haha"
        },
        "tags": [{
            "tagId": "test:test",
            "attributes": {
                "attr_name": "attr_value"
            }
        }],
        "terms": [{
            "termId": "test:test2"
        }]
    }]
}

注解

typeIdFileSet 时,需要去数据源注册页面获取对应的数据源信息,如 sourceId 等。

当数据源为 S3 时,需要指定 pattern 为 s3a://dataide/xia_s3/TEST/LC

返回示例

{
    "code": 0,
    "message": "",
    "data": {
        "create": ["LGGw8HDXvSonqnhxx02foerYWrQEAvBg"],
        "update": []
    }
}

错误码

代码 错误信息
41001 参数[%s]不能为空。
41090 Atlas详细错误信息: %s
41108 Tag[%s]不存在。
41134 每个entity打tag或者打term的数量上限为[%s],当前最大数量为[%s]。
41135 单次导入的entity数量上限为[%s],当前entity数量为[%s]。
41136 [%s]中的属性[%s]是必填的。
41137 [%s]不存在属性[%s]。
41138 实体没有任何属性,typeId为[%s]。
41143 [%s]不支持导入。
42002 术语[%s]不存在。
42039 属性[%s]的值与类型不匹配。
42052 [%s]类型不存在!
41071 类型[%s]暂不支持导入功能!
99000 服务器内部错误。