Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 10-20-2016 03:30 PM
I had a hard time finding a way to add a tag/traits in Atlas by using the REST API.
Here is a solution:
POST http://{YOUR IP ADRESS}:21000/api/atlas/entities/{GUID FOR ENTITY}/traits/
BODY {"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct","typeName":"PII","values":{}}
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" -d '{"jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct","typeName":"PII","values":{}}' "http://192.168.255.128:21000/api/atlas/entities/d5dcb483-d2fc-4544-8368-6ef56321efdb/traits/"
Created 12-21-2016 12:50 AM
Thanks @Anders Boje
Below are some additional examples:
Let's suppose we want to annotate a table (GUID f4019a65-8948- 46f1-afcf-545baa2df99f) with the Trait PublicData to indicate it is a data asset that is created by crawling public sites. Also, suppose that we want to set a "Retainable" trait on the column family contents (GUID 9e6308c6-1006-48f8-95a8-a605968e64d2) with a retention period of 100 days.
The following are the requests to send:
POST http://<atlas-server-host:port>/api/atlas/entities/f4019a65-8948-46f1-afcf- 545baa2df99f/traits BODY { "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct", "typeName":"PublicData", "values":{} }
POST http://<atlas-server-host:port>/api/atlas/entities/9e6308c6-1006-48f8-95a8- a605968e64d2/traits BODY { "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct", "typeName":"Retainable", "values":{"retentionPeriod":"100" } }
@Stig Hammeken
To associate a Term/Taxonomy to an entity use the below
POST http://<atlas-server-host:port>/api/atlas/v1/entities/{entity_guid}/tags/{fully_qualified_name_of_te...
for example:
POST http://<atlas-server-host:port>/api/atlas/v1/entities/f4019a65-8948-46f1-afcf-545baa2df99f/tags/d.te...
You can get the "fully_qualified_name_of_term" using:
#Listing all terms under the Catalog Taxonomy GET http://<atlas-server-host:port>/api/atlas/v1/taxonomies/Catalog/terms #Listing all terms under a given Term GET http://<atlas-server-host:port>/api/atlas/v1/taxonomies/Catalog/terms/term_name/terms/.../terms/term...
Created 12-20-2016 12:27 PM
Thanks Anders. It works fine, but not if the tag i a business term (tag) a trait type (super typer) "TaxonomyTerm". The REST interface respond with a "Error deserializing trait instance". Any idea how I add a Business Term to an Entity?
Created 12-21-2016 12:50 AM
Thanks @Anders Boje
Below are some additional examples:
Let's suppose we want to annotate a table (GUID f4019a65-8948- 46f1-afcf-545baa2df99f) with the Trait PublicData to indicate it is a data asset that is created by crawling public sites. Also, suppose that we want to set a "Retainable" trait on the column family contents (GUID 9e6308c6-1006-48f8-95a8-a605968e64d2) with a retention period of 100 days.
The following are the requests to send:
POST http://<atlas-server-host:port>/api/atlas/entities/f4019a65-8948-46f1-afcf- 545baa2df99f/traits BODY { "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct", "typeName":"PublicData", "values":{} }
POST http://<atlas-server-host:port>/api/atlas/entities/9e6308c6-1006-48f8-95a8- a605968e64d2/traits BODY { "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Struct", "typeName":"Retainable", "values":{"retentionPeriod":"100" } }
@Stig Hammeken
To associate a Term/Taxonomy to an entity use the below
POST http://<atlas-server-host:port>/api/atlas/v1/entities/{entity_guid}/tags/{fully_qualified_name_of_te...
for example:
POST http://<atlas-server-host:port>/api/atlas/v1/entities/f4019a65-8948-46f1-afcf-545baa2df99f/tags/d.te...
You can get the "fully_qualified_name_of_term" using:
#Listing all terms under the Catalog Taxonomy GET http://<atlas-server-host:port>/api/atlas/v1/taxonomies/Catalog/terms #Listing all terms under a given Term GET http://<atlas-server-host:port>/api/atlas/v1/taxonomies/Catalog/terms/term_name/terms/.../terms/term...
Created 12-22-2016 02:24 PM
Thank you Eyad you nailed it for me:-)
API "Tags" = Business Term
API "Traits" = Tag
Created 12-22-2016 02:27 PM
Actually you mean:
API "Terms" = Business Term
API "Traits" = Tag