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

How to add classification to an existing entity?

New Contributor

Hi, I try to use post /v2/entity to create or update entities (as described in the doc), but it cannot add classification to an existing entity while it can update the attributes of the entity. 

I also try POST /v2/entity/bulk/classification using the following request: 

{
"classification": {"entityStatus": "ACTIVE", "propagate": True, "removePropagationsOnEntityDelete": True, "typeName": "my_tag"},
"entitiesUniqueAttributes": [{"property1": {"qualifiedName": "my_name"}}],
"entityTypeName": "my_type"

It does not work, either.  

2 REPLIES 2

Cloudera Employee

Hi @claudialeee ,

 

You can use POST /v2/entity/guid/{guid}/classifications to add classifications to an existing entity represented by a guid.

 

Example:

To add classification "demo" to an entity represented by a GUID 88daa7d6-90e6-48bc-94f7-7560158c68f3,

# curl -u <Username>:<password> -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST "http://<Atlas server FQDN>:<Atlas port>/api/atlas/v2/entity/guid/88daa7d6-90e6-48bc-94f7-7560158c68f..." -d '[{"typeName":"demo"}]' 


Please try this and let me know if this helps!


Thanks,
Prashanth Vishnu

New Contributor

Hi @pvishnu, thanks for the reply. Actually I am trying to create an entity or update an entity if already existed by its unique attribute (QualifiedName), instead of first getting a guid. In this case, post v2/entity seems to be the best fit. It can update the attributes of the entity but it cannot add classification to it. Can it work as expected? If so, that will be ideal. 

Also, I tried what you suggested, but I still got an error: There was an error processing your request. It has been logged (ID ccfeb9583f4b2242). Where can I see the log?