Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

REST API for assigning tag to an entity

avatar
New Contributor

Hi Experts,

I would want to know if there is any REST API for creating tags in Atlas and assigning those tags to its respected entity. If there is any API can your'll send it with what should be put in the body.

Below are the screenshot of the apis which were tried in which one was giving an error while the other one was working fine for assigning term to an entity.

Thank You.

62789-api-v2-atlas.png


atlas-api.png
1 ACCEPTED SOLUTION

avatar
Super Collaborator
@Alisha Vaz

POST the attached create-tag.txt to following REST API to create a tag named PII

http://localhost:21000/api/atlas/v2/types/typedefs?type=classification

After tag creation , get the GUID of the entity in Atlas which has to be associated to the tag.

If you want to associate to an hive_table entity by name employee which is in default database , fetch the GUID of the entity using DSL search :

typename = hive_table , query = where qualifiedName="default.employee@cl1" select __guid

Fetch the GUID and post the associate-tag.txt to the following REST API:

http://localhost:21000/api/atlas/v2/entity/bulk/classification

In the associate-tag.txt file , in "entityGuids" json array ,replace the existing GUID with the GUID fetched from the DSL search query.

Please refer to http://atlas.apache.org/api/v2/resource_TypesREST.html for more information on creating,updating,deleting tags and http://atlas.apache.org/api/v2/resource_EntityREST.html#resource_EntityREST_addClassification_POST for associating tags to entities.

View solution in original post

1 REPLY 1

avatar
Super Collaborator
@Alisha Vaz

POST the attached create-tag.txt to following REST API to create a tag named PII

http://localhost:21000/api/atlas/v2/types/typedefs?type=classification

After tag creation , get the GUID of the entity in Atlas which has to be associated to the tag.

If you want to associate to an hive_table entity by name employee which is in default database , fetch the GUID of the entity using DSL search :

typename = hive_table , query = where qualifiedName="default.employee@cl1" select __guid

Fetch the GUID and post the associate-tag.txt to the following REST API:

http://localhost:21000/api/atlas/v2/entity/bulk/classification

In the associate-tag.txt file , in "entityGuids" json array ,replace the existing GUID with the GUID fetched from the DSL search query.

Please refer to http://atlas.apache.org/api/v2/resource_TypesREST.html for more information on creating,updating,deleting tags and http://atlas.apache.org/api/v2/resource_EntityREST.html#resource_EntityREST_addClassification_POST for associating tags to entities.