You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Nigel Jones <jo...@uk.ibm.com> on 2015/10/13 17:48:48 UTC

AtlasClient.java

The AtlasClient is tempting for Java users to make use of, but I was 
wondering where it's expected to go.. I tend to see it as sample code 
but not more. Programmers may use their favoured frameworks/patterns, 
and all focus is on the rest API (or the bridge plugin mechanism).

Is that fair?

nigel jones


Re: AtlasClient.java

Posted by Herman Yu <he...@teeupdata.com>.
Thanks John.  It turned out that I had an invalid JSON file due to some unknown/invisible characters even thought it looked absolutely valid. After using a JSON validator, I am now able to create entities.

Thanks.
Herman.



> On Oct 16, 2015, at 10:04 AM, John Speidel III <js...@hortonworks.com> wrote:
> 
> Here is an example of creating an entity.  For the id/id field, you need to provide a value and from what I have experienced, it needs to be a negative number.  You can just keep the value from this example.
> 
> 
> http://c6401.ambari.apache.org:21000/api/atlas/entities
> 
> [
> {
> "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
> "id":{
>   "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
>   "id":"-1875651412683",
>   "version":0,
>   "typeName":"hive_db"
> },
> "typeName":"hive_db",
> "values":{
>   "name":"Test1",
>   "clusterName":"c1",
>   "description":"Test Database",
>   "locationUri":"hdfs://host:8000/apps/warehouse/sales",
>   "owner":"John ETL"
> },
> "traitNames":[
> 
> ],
> "traits":{
> 
> }
> }
> ]
> ________________________________________
> From: Nigel Jones <jo...@uk.ibm.com>
> Sent: Friday, October 16, 2015 9:08 AM
> To: dev@atlas.incubator.apache.org
> Subject: Re: AtlasClient.java
> 
> On 14/10/15 15:17, Erik Bergenholtz wrote:
>> In the mean time, see attached pdf which will hopefully get you a step
>> closer. Note that this does not reflect a recent change in the entities
>> resource.
> 
> Hi Erik,
> I'm also interested in the pdf, but couldn't see an attachment from
> either my email subscription address, or via gmane (where I usually read
> from) Was it included?
> 
> many thanks
> Nigel.
> 
> 


Re: AtlasClient.java

Posted by John Speidel III <js...@hortonworks.com>.
Here is an example of creating an entity.  For the id/id field, you need to provide a value and from what I have experienced, it needs to be a negative number.  You can just keep the value from this example.


http://c6401.ambari.apache.org:21000/api/atlas/entities

[
{
  "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
  "id":{
    "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
    "id":"-1875651412683",
    "version":0,
    "typeName":"hive_db"
  },
  "typeName":"hive_db",
  "values":{
    "name":"Test1",
    "clusterName":"c1",
    "description":"Test Database",
    "locationUri":"hdfs://host:8000/apps/warehouse/sales",
    "owner":"John ETL"
  },
  "traitNames":[

  ],
  "traits":{

  }
}
]
________________________________________
From: Nigel Jones <jo...@uk.ibm.com>
Sent: Friday, October 16, 2015 9:08 AM
To: dev@atlas.incubator.apache.org
Subject: Re: AtlasClient.java

On 14/10/15 15:17, Erik Bergenholtz wrote:
> In the mean time, see attached pdf which will hopefully get you a step
> closer. Note that this does not reflect a recent change in the entities
> resource.

Hi Erik,
I'm also interested in the pdf, but couldn't see an attachment from
either my email subscription address, or via gmane (where I usually read
from) Was it included?

many thanks
Nigel.



Re: AtlasClient.java

Posted by Nigel Jones <jo...@uk.ibm.com>.
On 14/10/15 15:17, Erik Bergenholtz wrote:
> In the mean time, see attached pdf which will hopefully get you a step
> closer. Note that this does not reflect a recent change in the entities
> resource.

Hi Erik,
I'm also interested in the pdf, but couldn't see an attachment from 
either my email subscription address, or via gmane (where I usually read 
from) Was it included?

many thanks
Nigel.



Re: AtlasClient.java

Posted by Erik Bergenholtz <eb...@hortonworks.com>.
Hi Herman,

This is still a work in progress. I will publish what we have shortly on the Atlas Wiki - it still needs some love but is a step up from the generated API doc: http://atlas.incubator.apache.org/api/rest.html. In the mean time, see attached pdf which will hopefully get you a step closer. Note that this does not reflect a recent change in the entities resource.

Erik

Re: AtlasClient.java

Posted by Herman Yu <he...@teeupdata.com>.
Jira Atlas-230 is created asking for detail documentation/samples of REST API.

At meanwhile, can someone help provide some insights on how to create an entity through REST API? supposedly the POST method of http:…/api/atlas/entities will do the job, however, I couldn’t make it work:

class definition: 

{
     "typeName”:”BusinessMetadata",
     "attributeDefinitions":[
       {
         "name”:”Category",
         "dataTypeName”:”string",
         …
       },
       ...
     ]
}

JSON passed to the REST API: 

{
	  "typeName":"BusinessMetaData",
	  "values":{
	    "category":"MiddleOffice",
           …..
	  }
}

this results with exceptions “Unable to persist entity instance (EntityResource:112) java.lang.IllegalArgumentException: Unable to deserialize son”

Thanks
Herman.


> On Oct 13, 2015, at 8:02 PM, Seetharam Venkatesh <ve...@innerzeal.com> wrote:
> 
> Agreed that Atlas is quite thin on documentation. Please open a jira and we
> will try to add more documentation.
> 
> Let me clarify about the APIs.
> 
> There are 2 parts to Atlas,
> 
> 1. Data Models aka Types that are expressed using the flexible type system
> API
> The type and entity (typed instances) are Data Models expressed using the
> type system API - think of it like POJO. We provide a wrapper to serialize
> the data models as JSON to make it easy to send it over the wire.
> 
> 2. APIs to add data models and associated instances
> These APIs are RESTful - more akin to CRUD operations.
> 
> Does things make sense now?
> 
> On Tue, Oct 13, 2015 at 2:12 PM Herman Yu <he...@teeupdata.com> wrote:
> 
>> The challenge (at least for me) is there is no detail documentation of
>> REST API, e.g. I still can’t create new entities through REST API so has to
>> code in Java as the client does. I followed the same son structure as
>> traced out from log, but still get exceptions complaining either unknown
>> token or error deserialize json.
>> 
>> Thanks
>> Herman.
>> 
>> 
>>> On Oct 13, 2015, at 4:48 PM, Seetharam Venkatesh <
>> venkatesh@innerzeal.com> wrote:
>>> 
>>> The java client is a thin wrapper over the REST api and is provided for
>>> convenience. The intent was to provide a CLI based on this wrapper and is
>>> yet to be worked upon.
>>> 
>>> I agree with you that folks can directly sue the REST APIs from their
>>> favorite languages.
>>> 
>>> Thanks!
>>> 
>>> On Tue, Oct 13, 2015 at 8:49 AM Nigel Jones <jo...@uk.ibm.com> wrote:
>>> 
>>>> 
>>>> The AtlasClient is tempting for Java users to make use of, but I was
>>>> wondering where it's expected to go.. I tend to see it as sample code
>>>> but not more. Programmers may use their favoured frameworks/patterns,
>>>> and all focus is on the rest API (or the bridge plugin mechanism).
>>>> 
>>>> Is that fair?
>>>> 
>>>> nigel jones
>>>> 
>>>> 
>> 
>> 


Re: AtlasClient.java

Posted by Seetharam Venkatesh <ve...@innerzeal.com>.
Agreed that Atlas is quite thin on documentation. Please open a jira and we
will try to add more documentation.

Let me clarify about the APIs.

There are 2 parts to Atlas,

1. Data Models aka Types that are expressed using the flexible type system
API
The type and entity (typed instances) are Data Models expressed using the
type system API - think of it like POJO. We provide a wrapper to serialize
the data models as JSON to make it easy to send it over the wire.

2. APIs to add data models and associated instances
These APIs are RESTful - more akin to CRUD operations.

Does things make sense now?

On Tue, Oct 13, 2015 at 2:12 PM Herman Yu <he...@teeupdata.com> wrote:

> The challenge (at least for me) is there is no detail documentation of
> REST API, e.g. I still can’t create new entities through REST API so has to
> code in Java as the client does. I followed the same son structure as
> traced out from log, but still get exceptions complaining either unknown
> token or error deserialize json.
>
> Thanks
> Herman.
>
>
> > On Oct 13, 2015, at 4:48 PM, Seetharam Venkatesh <
> venkatesh@innerzeal.com> wrote:
> >
> > The java client is a thin wrapper over the REST api and is provided for
> > convenience. The intent was to provide a CLI based on this wrapper and is
> > yet to be worked upon.
> >
> > I agree with you that folks can directly sue the REST APIs from their
> > favorite languages.
> >
> > Thanks!
> >
> > On Tue, Oct 13, 2015 at 8:49 AM Nigel Jones <jo...@uk.ibm.com> wrote:
> >
> >>
> >> The AtlasClient is tempting for Java users to make use of, but I was
> >> wondering where it's expected to go.. I tend to see it as sample code
> >> but not more. Programmers may use their favoured frameworks/patterns,
> >> and all focus is on the rest API (or the bridge plugin mechanism).
> >>
> >> Is that fair?
> >>
> >> nigel jones
> >>
> >>
>
>

Re: AtlasClient.java

Posted by Herman Yu <he...@teeupdata.com>.
The challenge (at least for me) is there is no detail documentation of REST API, e.g. I still can’t create new entities through REST API so has to code in Java as the client does. I followed the same son structure as traced out from log, but still get exceptions complaining either unknown token or error deserialize json.

Thanks
Herman.


> On Oct 13, 2015, at 4:48 PM, Seetharam Venkatesh <ve...@innerzeal.com> wrote:
> 
> The java client is a thin wrapper over the REST api and is provided for
> convenience. The intent was to provide a CLI based on this wrapper and is
> yet to be worked upon.
> 
> I agree with you that folks can directly sue the REST APIs from their
> favorite languages.
> 
> Thanks!
> 
> On Tue, Oct 13, 2015 at 8:49 AM Nigel Jones <jo...@uk.ibm.com> wrote:
> 
>> 
>> The AtlasClient is tempting for Java users to make use of, but I was
>> wondering where it's expected to go.. I tend to see it as sample code
>> but not more. Programmers may use their favoured frameworks/patterns,
>> and all focus is on the rest API (or the bridge plugin mechanism).
>> 
>> Is that fair?
>> 
>> nigel jones
>> 
>> 


Re: AtlasClient.java

Posted by Seetharam Venkatesh <ve...@innerzeal.com>.
The java client is a thin wrapper over the REST api and is provided for
convenience. The intent was to provide a CLI based on this wrapper and is
yet to be worked upon.

I agree with you that folks can directly sue the REST APIs from their
favorite languages.

Thanks!

On Tue, Oct 13, 2015 at 8:49 AM Nigel Jones <jo...@uk.ibm.com> wrote:

>
> The AtlasClient is tempting for Java users to make use of, but I was
> wondering where it's expected to go.. I tend to see it as sample code
> but not more. Programmers may use their favoured frameworks/patterns,
> and all focus is on the rest API (or the bridge plugin mechanism).
>
> Is that fair?
>
> nigel jones
>
>