You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Demai Ni <ni...@gmail.com> on 2014/02/04 02:55:00 UTC

HBase Rest Put examples/errors

hi, folks,

I am trying to put a row through REST API and linux command.

I started REST server (using port 8500), and be able to create a table:
create 't2_dn','cf1'

And then, I used this command to insert a row
 curl -v -X PUT 'http://localhost:8500/t2_dn/row1/cf1:q1' -H "Accept:
application/json" -H "Content-Type: application/json" --data '{"Row":{
"@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}'
but failed with error:
> {"Row":{ "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}HTTP/1.1
500 Can not deserialize instance of java.util.List out of START_OBJECT
token  at [Source: org.mortbay.jetty.HttpParser$Input@1a841a84; line: 1,
column: 2] (through reference chain:
org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])

I have googled a couple examples, such as here:
http://stackoverflow.com/questions/14614669/hbase-rest-api-stargate-post-multiple-cells-rows

Would someone give me some hints or point to a few more examples? many
thanks

Demai

Re: HBase Rest Put examples/errors

Posted by Ted Yu <yu...@gmail.com>.
Looking at the history of HBASE-9435, Francis offered to submit a patch for
refguide.

There was no JIRA linked to HBASE-9435 on the doc update though.

Cheers


On Tue, Feb 4, 2014 at 5:38 PM, Demai Ni <ni...@gmail.com> wrote:

> Ted and all,
>
> I finally figured it out that hbase 9435 introduced the incompatible change
> to 0.96.0.  like remove '@', add '[]' , etc.
>
> Well, when I google 'hbase rest',  the documentations are still showing the
> old syntax. :-)
>
> Maybe http://wiki.apache.org/hadoop/Hbase/Stargate can add an example? and
> maybe highlights the incompatible change?
>
> Demai
>
>
> On Mon, Feb 3, 2014 at 8:20 PM, Demai Ni <ni...@gmail.com> wrote:
>
> > Ted,
> >
> > thanks. I looked at the wiki page. However, for the Cell(store) section,
> > the example looks like :
> >
> >  curl -H "Content-Type: text/xml" --data '[...]'
> http://localhost:8000/test/testrow/test:testcolumn
> >
> > Probably too simple an example to show a full statement? I am sure
> curious
> > about why there is no 'PUT' in the above example.
> >
> > Anyway, I must make a simple syntax mistake in my 'put' statements, but
> > just couldn't figure out why...
> >
> > Demai
> >
> >
> > On Mon, Feb 3, 2014 at 7:51 PM, Ted Yu <yu...@gmail.com> wrote:
> >
> >> Have you looked at Cell Query (Single Value) section of
> >> http://wiki.apache.org/hadoop/Hbase/Stargate ?
> >>
> >> Cheers
> >>
> >>
> >> On Mon, Feb 3, 2014 at 5:55 PM, Demai Ni <ni...@gmail.com> wrote:
> >>
> >> > hi, folks,
> >> >
> >> > I am trying to put a row through REST API and linux command.
> >> >
> >> > I started REST server (using port 8500), and be able to create a
> table:
> >> > create 't2_dn','cf1'
> >> >
> >> > And then, I used this command to insert a row
> >> >  curl -v -X PUT 'http://localhost:8500/t2_dn/row1/cf1:q1' -H "Accept:
> >> > application/json" -H "Content-Type: application/json" --data '{"Row":{
> >> > "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}'
> >> > but failed with error:
> >> > > {"Row":{ "@key":"row1","Cell":{"@column":"cf1:q1",
> >> "$":"val1"}}}HTTP/1.1
> >> > 500 Can not deserialize instance of java.util.List out of START_OBJECT
> >> > token  at [Source: org.mortbay.jetty.HttpParser$Input@1a841a84; line:
> >> 1,
> >> > column: 2] (through reference chain:
> >> > org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])
> >> >
> >> > I have googled a couple examples, such as here:
> >> >
> >> >
> >>
> http://stackoverflow.com/questions/14614669/hbase-rest-api-stargate-post-multiple-cells-rows
> >> >
> >> > Would someone give me some hints or point to a few more examples? many
> >> > thanks
> >> >
> >> > Demai
> >> >
> >>
> >
> >
>

Re: HBase Rest Put examples/errors

Posted by Demai Ni <ni...@gmail.com>.
Ted and all,

I finally figured it out that hbase 9435 introduced the incompatible change
to 0.96.0.  like remove '@', add '[]' , etc.

Well, when I google 'hbase rest',  the documentations are still showing the
old syntax. :-)

Maybe http://wiki.apache.org/hadoop/Hbase/Stargate can add an example? and
maybe highlights the incompatible change?

Demai


On Mon, Feb 3, 2014 at 8:20 PM, Demai Ni <ni...@gmail.com> wrote:

> Ted,
>
> thanks. I looked at the wiki page. However, for the Cell(store) section,
> the example looks like :
>
>  curl -H "Content-Type: text/xml" --data '[...]' http://localhost:8000/test/testrow/test:testcolumn
>
> Probably too simple an example to show a full statement? I am sure curious
> about why there is no 'PUT' in the above example.
>
> Anyway, I must make a simple syntax mistake in my 'put' statements, but
> just couldn't figure out why...
>
> Demai
>
>
> On Mon, Feb 3, 2014 at 7:51 PM, Ted Yu <yu...@gmail.com> wrote:
>
>> Have you looked at Cell Query (Single Value) section of
>> http://wiki.apache.org/hadoop/Hbase/Stargate ?
>>
>> Cheers
>>
>>
>> On Mon, Feb 3, 2014 at 5:55 PM, Demai Ni <ni...@gmail.com> wrote:
>>
>> > hi, folks,
>> >
>> > I am trying to put a row through REST API and linux command.
>> >
>> > I started REST server (using port 8500), and be able to create a table:
>> > create 't2_dn','cf1'
>> >
>> > And then, I used this command to insert a row
>> >  curl -v -X PUT 'http://localhost:8500/t2_dn/row1/cf1:q1' -H "Accept:
>> > application/json" -H "Content-Type: application/json" --data '{"Row":{
>> > "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}'
>> > but failed with error:
>> > > {"Row":{ "@key":"row1","Cell":{"@column":"cf1:q1",
>> "$":"val1"}}}HTTP/1.1
>> > 500 Can not deserialize instance of java.util.List out of START_OBJECT
>> > token  at [Source: org.mortbay.jetty.HttpParser$Input@1a841a84; line:
>> 1,
>> > column: 2] (through reference chain:
>> > org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])
>> >
>> > I have googled a couple examples, such as here:
>> >
>> >
>> http://stackoverflow.com/questions/14614669/hbase-rest-api-stargate-post-multiple-cells-rows
>> >
>> > Would someone give me some hints or point to a few more examples? many
>> > thanks
>> >
>> > Demai
>> >
>>
>
>

Re: HBase Rest Put examples/errors

Posted by Demai Ni <ni...@gmail.com>.
Ted,

thanks. I looked at the wiki page. However, for the Cell(store) section,
the example looks like :

 curl -H "Content-Type: text/xml" --data '[...]'
http://localhost:8000/test/testrow/test:testcolumn

Probably too simple an example to show a full statement? I am sure curious
about why there is no 'PUT' in the above example.

Anyway, I must make a simple syntax mistake in my 'put' statements, but
just couldn't figure out why...

Demai


On Mon, Feb 3, 2014 at 7:51 PM, Ted Yu <yu...@gmail.com> wrote:

> Have you looked at Cell Query (Single Value) section of
> http://wiki.apache.org/hadoop/Hbase/Stargate ?
>
> Cheers
>
>
> On Mon, Feb 3, 2014 at 5:55 PM, Demai Ni <ni...@gmail.com> wrote:
>
> > hi, folks,
> >
> > I am trying to put a row through REST API and linux command.
> >
> > I started REST server (using port 8500), and be able to create a table:
> > create 't2_dn','cf1'
> >
> > And then, I used this command to insert a row
> >  curl -v -X PUT 'http://localhost:8500/t2_dn/row1/cf1:q1' -H "Accept:
> > application/json" -H "Content-Type: application/json" --data '{"Row":{
> > "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}'
> > but failed with error:
> > > {"Row":{ "@key":"row1","Cell":{"@column":"cf1:q1",
> "$":"val1"}}}HTTP/1.1
> > 500 Can not deserialize instance of java.util.List out of START_OBJECT
> > token  at [Source: org.mortbay.jetty.HttpParser$Input@1a841a84; line: 1,
> > column: 2] (through reference chain:
> > org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])
> >
> > I have googled a couple examples, such as here:
> >
> >
> http://stackoverflow.com/questions/14614669/hbase-rest-api-stargate-post-multiple-cells-rows
> >
> > Would someone give me some hints or point to a few more examples? many
> > thanks
> >
> > Demai
> >
>

Re: HBase Rest Put examples/errors

Posted by Ted Yu <yu...@gmail.com>.
Have you looked at Cell Query (Single Value) section of
http://wiki.apache.org/hadoop/Hbase/Stargate ?

Cheers


On Mon, Feb 3, 2014 at 5:55 PM, Demai Ni <ni...@gmail.com> wrote:

> hi, folks,
>
> I am trying to put a row through REST API and linux command.
>
> I started REST server (using port 8500), and be able to create a table:
> create 't2_dn','cf1'
>
> And then, I used this command to insert a row
>  curl -v -X PUT 'http://localhost:8500/t2_dn/row1/cf1:q1' -H "Accept:
> application/json" -H "Content-Type: application/json" --data '{"Row":{
> "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}'
> but failed with error:
> > {"Row":{ "@key":"row1","Cell":{"@column":"cf1:q1", "$":"val1"}}}HTTP/1.1
> 500 Can not deserialize instance of java.util.List out of START_OBJECT
> token  at [Source: org.mortbay.jetty.HttpParser$Input@1a841a84; line: 1,
> column: 2] (through reference chain:
> org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])
>
> I have googled a couple examples, such as here:
>
> http://stackoverflow.com/questions/14614669/hbase-rest-api-stargate-post-multiple-cells-rows
>
> Would someone give me some hints or point to a few more examples? many
> thanks
>
> Demai
>