Created 01-09-2017 09:23 PM
Hi Team,
Hope you can help me out. I am using Atlas API to get the list of traits and create traits via API calls.
I am able to call the GET method without any issues. But when I call the POST method it gives an error as shown below:
Error - Unable to deserialize json
Below are the commands that I am executing:
Get All tags ---------------- Works fine
curl --user admin:admin -H "Content-Type: application/json" -X GET "http://ServerName:Port/api/atlas/types?type=TRAIT"
Create tag ----------------- Gives Error
curl --user "admin:admin" -H "Content-Type: application/json" -d "createtag.txt" -X POST "http://ServerName:Port/api/atlas/types"
Created 01-09-2017 09:45 PM
Please try this json
{ "enumTypes":[], "structTypes":[], "traitTypes":[ { "superTypes":[], "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.TraitType", "typeName":"NAME_OF_TAG_TO_CREATE", "typeDescription":null, "attributeDefinitions":[] }
Created 01-09-2017 09:45 PM
Please try this json
{ "enumTypes":[], "structTypes":[], "traitTypes":[ { "superTypes":[], "hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.TraitType", "typeName":"NAME_OF_TAG_TO_CREATE", "typeDescription":null, "attributeDefinitions":[] }
Created 01-10-2017 09:19 AM
Hi Sunile,
I tried the json you provided, but still am getting the same error.
Created 01-10-2017 04:00 PM
here is example where my.json has content from above
curl -X POST -d @my.json -u admin:admin -H 'Content-Type: application/json; charset=UTF-8' 127.0.0.1:21000/api/atlas/types
more examples here
Created 01-10-2017 12:04 PM
Hi @Jigar Chhadwa , provide createtag.txt as @createtag.txt . In your case,curl command took "createtag.txt" itself as the json instead of the content in the file.
Example :
curl --user "admin:admin" -H "Content-Type: application/json" -d @createtag.txt -X POST "http://ServerName:Port/api/atlas/types"
Created 01-10-2017 04:14 PM
createtag.txtatlas-api-call-and-error.txtGot it @Sharmadha Sainath , I tried with the new command but got the same error as before. I changed the name of the tag and the description. Also since GET is working fine, I got the definition from one of the tags which is already created from the UI, so the definition seems to be the correct one.
Created 02-28-2017 04:21 PM
This was resolved with the corrected json input. the description column was missing.
thanks all