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

Unable to add a description data in TAGS in ATLAS through CURL

Explorer

Hi,

Please let me know where i need to put the description value in below CURL command

curl -v -u admin:admin -H "Content-Type: application/json" -X PUT -d '[ { "typeName": "Test", "attributes": { "attr1":"valu1", "attr2":true, "attr3": 60 } }, { "typeName": "Test", "attributes": { "attr4":"valu1", "attr5":true, "attr6": 60 }} ]' http://localhost:21000/api/atlas/v2/entity/guid/686bbea3-0c7b-41f1-98af-9feddb6f741f/classifications

Thanks in advance..!!!

1 ACCEPTED SOLUTION

Contributor

Are you trying to add a description to a tag? If so you are using the wrong API. The one you are using is to add tags to entities, like hive tables.

To add a description to a tag you need to use /v2/types/typedefs (POST to add a new tag and PUT to edit an existing one )- see https://atlas.apache.org/api/v2/ui/index.html#!/TypesREST/resource_TypesREST_createAtlasTypeDefs_POS...

{
  "classificationDefs":[
    {
      "createdBy": "admin",
      "name": "test_tag_name",
      "description": "Description of your tag",
      "attributeDefs": [
          {
            "name":"attribute_name_1",
            "typeName":"string",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          },
		  {
            "name":"attribute_name_2",
            "typeName":"string",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          },
		  {
            "name":"update_date",
            "typeName":"date",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          }],
     "superTypes": []
    }
  ]
}

View solution in original post

6 REPLIES 6

Contributor

Are you trying to add a description to a tag? If so you are using the wrong API. The one you are using is to add tags to entities, like hive tables.

To add a description to a tag you need to use /v2/types/typedefs (POST to add a new tag and PUT to edit an existing one )- see https://atlas.apache.org/api/v2/ui/index.html#!/TypesREST/resource_TypesREST_createAtlasTypeDefs_POS...

{
  "classificationDefs":[
    {
      "createdBy": "admin",
      "name": "test_tag_name",
      "description": "Description of your tag",
      "attributeDefs": [
          {
            "name":"attribute_name_1",
            "typeName":"string",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          },
		  {
            "name":"attribute_name_2",
            "typeName":"string",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          },
		  {
            "name":"update_date",
            "typeName":"date",
            "isOptional":"true",
            "isUnique":"false",
            "isIndexable":"true",
            "cardinality":"SINGLE"
          }],
     "superTypes": []
    }
  ]
}

Explorer

@Laura Ngo , Thanks for u r quick response,

I tried with POST and http://localhost:21000/api/atlas/v2/types/typedefs ,

Command executed fine and no errors are showing

But new value is not reflected , Still its showing old Typedefs

New Typedef not added

Can you please help on this...!!!

Thanks in Advance

Contributor

If you want to change something you need to use PUT. Use POST to add new tags.

Explorer

@Laura Ngo , I tried with POST also , Same issue, Its not reflecting

Expert Contributor

Do you see any exceptions in the logs?

Explorer

@Ashutosh Mestry , Its Syntax Mistake, Now working Fine..Thanks....!!!

; ;