Atlas Rest API

发布时间 2024-01-05 10:41:09作者: 粒子先生

Atlas Rest API
总结部分Rest API,其他API查看Atlas官网Atlas Rest API

AdminREST
查看Atlas Metadata Server节点状态 GET /admin/status
curl -s -u admin:admin "http://node2:21000/api/atlas/admin/status"|jq

ACTIVE:此实例处于活跃状态,可以响应用户请求。
PASSIVE:此实例处于被动状态。它会将收到的任何用户请求重定向到当前ACTIVE实例。
BECOMING_ACTIVE:此实例正在转换为ACTIVE实例,在此状态下无法为用户提供请求服务。
BECOMING_PASSIVE:此实例正在转换为PASSIVE实例,在此状态下无法为用户提供请求服务。

注意:正常情况下,只有一个应该为ACTIVE状态,其他实例均为PASSIVE状态。
查看Atlas版本和描述 GET /admin/version
curl -s -u admin:admin "http://node2:21000/api/atlas/admin/version"|jq
DiscoveryREST
基本搜索 GET /v2/search/basic
#查询所有Hive表
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/search/basic?typeName=hive_table"|jq

#查询所有Hive表,且包含某一关键字
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/search/basic?query=dim_channel&typeName=hive_table"|jq
DSL 搜索 GET /v2/search/dsl
#DSL方式查询Hive表
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/search/dsl?typeName=hive_table&query=where%20name%3D%22dim_channel%22"|jq

注意:URL中特殊字符编码。
全文检索 GET /v2/search/fulltext
#全文检索方式查询
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/search/fulltext?query=where%20name%3D%22dim_channel%22"|jq

TypesREST
检索所有Type,并返回所有信息 GET /v2/types/typedefs
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/types/typedefs"|jq
检索所有Type,并返回最少信息 GET /v2/types/typedefs/headers
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/types/typedefs/headers"|jq
如:
{
"guid": "77edd2dc-cc4e-4980-ae65-b3dd72cf5980",
"name": "dim_table",
"category": "CLASSIFICATION"
},
{
"guid": "9d6c9b56-b91b-45f5-9320-d10c67736d05",
"name": "fact_table",
"category": "CLASSIFICATION"
}
.......

EntityREST
批量根据GUID检索Entity GET /v2/entity/bulk
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/entity/bulk?minExtInfo=yes&guid=bcbc196a-74c1-45ff-ac6f-f749ec8fd9b0"|jq
获取某个Entity定义 GET /v2/entity/guid/{guid}
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/entity/guid/bcbc196a-74c1-45ff-ac6f-f749ec8fd9b0"|jq
获取某个Entity的TAG列表 GET /v2/entity/guid/{guid}/classifications
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/entity/guid/bcbc196a-74c1-45ff-ac6f-f749ec8fd9b0/classifications"|jq
LineageREST
查询某个Entity的Lineage GET /v2/lineage/{guid}
curl -s -u admin:admin "http://node2:21000/api/atlas/v2/lineage/bcbc196a-7