Support Questions
Find answers, ask questions, and share your expertise

How to fetch GUID of all defined tags(TRAITS) in apache atlas?

How to fetch GUID of all defined tags(TRAITS) in apache atlas?

Expert Contributor

Hi all,

I am using Atlas-Ranger sandbox machine,I know the API to DELETE the entities which are tagged under specific tag but i want to know how to delete those TRAITS using REST API.

for deleting traits,we must know the GUID of that trait(tag) because of that I have asked above question.

I am thinking that we can delete all tags from Atlas UI onece we get GUID of it.

Thanks in advance

1 REPLY 1

Re: How to fetch GUID of all defined tags(TRAITS) in apache atlas?

Guru

When you create a new Trait/Tag in the UI are are actually creating a new type. When you associate it with an entity you are creating an instance of the Trait as a STRUCT type that only exists in the context of that entity. As you know, you can delete instances of a tag that is assigned to an entity. However, to delete the tag so that it does not show up in Atlas UI you would need to delete the type. At the moment, types cannot be deleted since there may be entities or even other types that are dependent on them. You probably can delete the trait directly from HBase, however, you may also compromise the integrity of the entire Atlas system. You would also have to clear any dependents that are indexed in Solr or graphed in Titan. You can get the instance of a trait only from the entity where the trait is associated as follows:

curl -u admin:admin -X GET http://sandbox.hortonworks.com:21000/api/atlas/entities/fadaca14-7e58-4a2e-b04d-95a3010ce45b/traits{"requestId":"qtp921483514-312 - bb0f1276-c8fc-499b-ab5d-0e4fde11c796","results":["PII"],"count":1}

As you can see, this entity has a tag called PII and it does not have a GUID because it is STRUCT, not an entity, based on the PII type that represents PII trait.

"traits":{"PII":{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct","typeName":"PII","values":{}}}}}

You can easily delete the STRUCT that is associated with an entity through the UI or REST api but there is now way to remove the type from which the trait is spawned for the reasons listed above.