Support Questions

Find answers, ask questions, and share your expertise

How to perfrom update (REST API - PUT) operation of apache atlas entity

avatar
Contributor

IHi All,

I am getting one issue while updating my existing entity using PUT calls.

I have downloaded json by using GET and i just trying to update my entity (i have tried updating description also tried not updating anything and PUT as it is ) using PUT operation and its failing with same reason  -  

"errorCode":"ATLAS-400-00-023","errorMessage":"Attribute null not found for type hive_table"   

could you please advise how did you update the entity using PUT command ?   

curl --negotiate -u : -X PUT   -H "Content-Type: application/json"   https://myURL:portNumber/api/atlas/v2/entity/guid/<myGuid>-d @downloaded_entity.json

 

i have referred this post , however its not showing how to perform PUT operation.   Solved: Re: PARTIAL UPDATE APACHE ATLAS ENTITY GUI - Cloudera Community - 297845

 

so my question is - Does atals REST PAI allows updating entity ?  my usecase is i want to update an hive table entity. I have hive table hive column relationship in place. now i want to update my hive-table entity by adding hive columns under attributes: { columns [...]}  

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@bigdatacm Can you try this I hope it will work

i.e

curl " https://URL/api/atlas/v2/entity/guid/7g5678h9-4003-407a-ac00-791c7c53e6d5" \
        -i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password >> test_oracle_tbl.json -k

and then modify the test_oracle_tbl.json and make a partial update to the entity

curl "https://hostname:port/api/atlas/v2/entity/uniqueAttribute/type/datsetname?attr:qualifiedName=name"
-i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password -d@test_oracle_tbl.json -k

View solution in original post

14 REPLIES 14

avatar
Expert Contributor

@jhoney12  yes Atlas Rest API supports , but you need to download the JSON for the entity first.

i.e

curl " https://URL/api/atlas/v2/entity/guid/7g5678h9-4003-407a-ac00-791c7c53e6d5" \
        -i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password >> test_oracle_tbl.json -k

and then modify the test_oracle_tbl.json and make a partial update to the entity

curl "https://hostname:port/api/atlas/v2/entity/uniqueAttribute/type/datsetname?attr:qualifiedName=name"
-i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password -d@test_oracle_tbl.json -k





avatar
Expert Contributor

@jhoney12 https://atlas.apache.org/api/v2/resource_EntityREST.html#resource_EntityREST_partialUpdateEntityAttr...

Note-Entity Partial Update - Add/Update entity attribute identified by its GUID. Supports only uprimitive attribute type and entity references. does not support updation of complex types like arrays, maps Null updates are not possible

avatar
Contributor

Documentation saying syntax as follows.  

PUT /v2/entity/guid/{guid} 

 

avatar
Expert Contributor

@bigdatacm Can you try this I hope it will work

i.e

curl " https://URL/api/atlas/v2/entity/guid/7g5678h9-4003-407a-ac00-791c7c53e6d5" \
        -i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password >> test_oracle_tbl.json -k

and then modify the test_oracle_tbl.json and make a partial update to the entity

curl "https://hostname:port/api/atlas/v2/entity/uniqueAttribute/type/datsetname?attr:qualifiedName=name"
-i -X GET --negotiate \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -u username:password -d@test_oracle_tbl.json -k

avatar
Contributor

yes, it works with PUT command in place not get command.