You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@atlas.apache.org by Marcel-Jan Krijgsman <ma...@opencirclesolutions.nl> on 2018/01/30 16:14:37 UTC

Can't seem to get Atlas REST API calls from Swagger to work. But others do work.

Hi,

At my customer's site we're going to implement Atlas (HDP 2.6.3) and I am preparing for that by finding out what Atlas REST API calls I can use to quickly label HDFS paths and Hive tables. I'm trying them out on a HDP 2.6.3 Sandbox (Atlas 1.0.0, I think). Atlas is running without problems. I can use the GUI, create tags and add tags.
I've tried using the examples from the Swagger site (http://atlas.apache.org/api/v2/ui/index.html#/), but often I can't get them to work.

I've found other REST API calls that do work, so it's not a big problem. I found these others with a lot of trial and error. But I would like to know if I'm doing something wrong or if there actually is a problem with the Swagger "prescribed" URLs.


Example 1: Showing available tags
This is what I derived from the Swagger UI (http://atlas.apache.org/api/v2/ui/index.html#!/TypesREST/resource_TypesREST_getAllTypeDefs_GET<http://atlas.apache.org/api/v2/ui/index.html%23!/TypesREST/resource_TypesREST_getAllTypeDefs_GET>). I've changed the address and added the username/password combination (only for testing purposes).
curl -X GET --header "Accept: text/html" "http://sandbox.hortonworks.com:21000/v2/types/typedefs" -u holger_gov:holger_gov

The response:
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /v2/types/typedefs. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>

Because some other working calls I've found use "api/atlas" before the /v2 part, I've also tried that:
curl -X GET --header "Accept: text/html" "http://sandbox.hortonworks.com:21000/api/atlas/v2/types/typedefs" -u holger_gov:holger_gov

But that results in an internal error:
HTTP/1.1 500 Internal Server Error
Date: Sun, 10 Dec 2017 14:55:11 GMT
Set-Cookie: ATLASSESSIONID=19x0czac5yij91r7g6am2fhjs0;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Frame-Options: DENY
Content-Type: text/html
Transfer-Encoding: chunked
Server: Jetty(9.2.12.v20150709)

There was an error processing your request. It has been logged (ID 9ebdadb08c253b4a).

I can't find any logs on this in /var/log/atlas.

Here is a working Atlas REST API call for this:
curl -i -X GET http://sandbox.hortonworks.com:21000/api/atlas/types?type=TRAIT -u holger_gov:holger_gov

The response:
{"results":["Order management","Standaard","Vertrouwelijk","Intern","PII3","Openbaar","Belangrijk","Persoonlijk herleidbaar","Persoonlijk_herleidbaar","Kritisch"],"count":10,"requestId":"pool-2-thread-8 - 49bf8f8f-e384-42cb-be78-daede0f9228d"}

See, it definitely is possible to retrieve this information.


Show information on one tag
Here I'm trying to get information on a tag type called Vertrouwelijk (English: confidential).

From the Swagger UI (http://atlas.apache.org/api/v2/ui/index.html#!/TypesREST/resource_TypesREST_getTypeDefByName_GET<http://atlas.apache.org/api/v2/ui/index.html%23!/TypesREST/resource_TypesREST_getTypeDefByName_GET>):
curl -X GET --header 'Accept: text/html' 'http://sandbox.hortonworks.com:21000/v2/types/typedef/name/Vertrouwelijk' -u holger_gov:holger_gov

The response:
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /v2/types/typedef/name/Vertrouwelijk. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>

So there's that again.

But now try this:
curl -i -X GET 'http://sandbox.hortonworks.com:21000/api/atlas/v2/types/typedef/name/Vertrouwelijk' -u holger_gov:holger_gov

The response:
{"category":"CLASSIFICATION","guid":"6ab9e4fb-a507-4cf9-b9e9-1d288f651b92","createTime":1511362880157,"updateTime":1511362880157,"version":1,"name":"Vertrouwelijk","description":"Informatie classificatie: vertrouwelijk","typeVersion":"1.0","attributeDefs":[],"superTypes":[]}

Or this one:
curl -i -X GET -u holger_gov:holger_gov 'http://sandbox.hortonworks.com:21000/api/atlas/types/Vertrouwelijk'

The response:
{"typeName":"Vertrouwelijk","definition":{"enumTypes":[],"structTypes":[],"traitTypes":[{"superTypes":[],"hierarchicalMetaTypeName":"org.apache.atlas.typesystem.types.TraitType","typeName":"Vertrouwelijk","typeDescription":"Informatie classificatie: vertrouwelijk","typeVersion":"1.0","attributeDefinitions":[]}],"classTypes":[]},"requestId":"pool-2-thread-8 - 4603fe6a-8c1a-48ea-8cf8-ab20f647c30b"}


Am I missing some crucial point?




[X]<http://www.opencirclesolutions.nl/>

Met vriendelijke groeten / Best regards,

Marcel-Jan Krijgsman
Data Engineer

Daalakkersweg  16-6
5641 JA | Eindhoven
mobile 06 21 626 420<tel:+31621626420>
tel 040 304 1330<tel:+31403041330>


www.opencirclesolutions.nl<http://www.opencirclesolutions.nl/> | marcel-jan.krijgsman@opencirclesolutions.nl<ma...@opencirclesolutions.nl>