Search code examples
hdpapache-atlas

What is the proper endpoint for HDP3.1 Atlas REST API?


Using Atlas v1.1 with HDP 3.1 and appear unable to access the api endpoint for making requests related to relationship characteristics. From the docs (here (for API access) and here (for specific endpoint)), I would think to do something like...

[hph_etl@HW03 ~]$ curl -v -u admin:admin -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' "http://hw03.co.local:21000/api/atlas/v2/relationship"


* About to connect() to hw03.co.local port 21000 (#0)
*   Trying 172.18.4.48...
* Connected to hw03.co.local (172.18.4.48) port 21000 (#0)
* Server auth using Basic with user 'admin'
> GET /api/atlas/v2/relationship HTTP/1.1
> Authorization: Basic xxxxxx
> User-Agent: curl/7.29.0
> Host: hw03.co.local:21000
> Content-Type: application/json
> Accept: application/json
>
< HTTP/1.1 500 Internal Server Error
< Date: Wed, 07 Aug 2019 01:55:43 GMT
< Set-Cookie: ATLASSESSIONID=xxxxxx;Path=/;HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: Jetty(9.3.14.v20161028)
<
* Connection #0 to host hw03.co.local left intact
There was an error processing your request. It has been logged (ID bfb6e6b45490d83a).[

to test for the endpoint, but it produces the error shown above. Yet, this is not the case for the types endpoint, eg.

[hph_etl@HW03 ~]$ curl -u admin:admin -X GET -H 'Content-Type: application/json' -H 'pplication/json' "http://hw03.co.local:21000/api/atlas/v2/types/typedefs"

<whole bunch of output>

which appears to work fine. Not sure what is going on here. Anyone with more Atlas (or REST) experience have any debugging suggestions or fixes?


Solution

  • From asking the apache-atlas user mailing list as well as looking into more docs, found that the proper endpoint is not just

    http://atlas-host-server/v2/<specific/api/endpoint>
    

    but rather

    http://atlas-host-server/api/atlas/v2/<specific/api/endpoint>
    

    So for creating a relationship between entities, you would do something like...

    curl -vv -u admin:admin -X POST --header 'Content-Type: application/json;charset=UTF-8' --header 'Accept: application/json' -d '{ \
       "end1": { \
         "guid": "2ddcda5b-2489-4636-a9ab-12b199c02422" \
       }, \
       "end2": { \
         "guid": "a33f45de-13d0-4a30-9df7-b0e02eb0dfd5" \
       }, \
       "typeName": "<some AtlasRelationshipDef>" \
     }' 'http://HW03.co.local:21000/api/atlas/v2/relationship'
    

    Got the information to use /api/atlas/ from a pdf downloadable from the apache-atlas official site, but could not find it to link here now (just goes to show how oddly hard that critical piece of info is to find).