You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Stuti Awasthi <st...@hcl.com> on 2011/09/01 14:41:53 UTC

Get query in REST for HBASE

Hi Friends,



I am trying to use  rest server and doing a query using : http://localhost:8080/tablename/rowkey

This lists me   following output :



<CellSet><Row key="Z2FnYW5zaA=="><Cell timestamp="1314870712846" column="aW5mbzphZ2U=">MzI=</Cell><Cell timestamp="1314870952929" column="aW5mbzpuYW1l">Z2FnYW4=</Cell></Row></CellSet>



Though I do receive timestamp, but rest of column familes(info:name and info:age) are not sent as a response.

Am I missing any step ? How can I receive data for column families directly through REST



Thanks & Regards
Stuti Awasthi
Sr Specialist


________________________________
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

RE: Get query in REST for HBASE

Posted by Stuti Awasthi <st...@hcl.com>.
Hi,
Thanks Andrew for the pointers. It worked after decoding from base-64.

Stuti

-----Original Message-----
From: Andrew Purtell [mailto:apurtell@apache.org] 
Sent: Thursday, September 01, 2011 6:21 PM
To: user@hbase.apache.org
Subject: Re: Get query in REST for HBASE

Because keys in HBase are byte[], the REST interface base-64 encodes row key, column name, and the value if you choose XML representation. 


> Though I do receive timestamp, but rest of column familes(info:name 
> and
> info:age) are not sent as a response.


You say you are looking for two values. This result has two values in the row:


            <CellSet><Row key="Z2FnYW5zaA=="> value 1 ->  <Cell timestamp="1314870712846" column="aW5mbzphZ2U=">MzI=</Cell> value 2 ->  <Cell timestamp="1314870952929" column="aW5mbzpuYW1l">Z2FnYW4=</Cell>
            </Row></CellSet>

So this looks probably correct. You need to run row key, column name, and value through a base 64 decoder, or choose a binary representation (using an Accept header in the request of either application/octet-stream, or application/x-protobuf).


Best regards,


        - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein (via Tom White)


----- Original Message -----
> From: Stuti Awasthi <st...@hcl.com>
> To: "user@hbase.apache.org" <us...@hbase.apache.org>
> Cc: 
> Sent: Thursday, September 1, 2011 8:41 PM
> Subject: Get query in REST for HBASE
> 
> Hi Friends,
> 
> 
> 
> I am trying to use  rest server and doing a query using : 
> http://localhost:8080/tablename/rowkey
> 
> This lists me   following output :
> 
> 
> 
> 
> 
> Though I do receive timestamp, but rest of column familes(info:name 
> and
> info:age) are not sent as a response.
> 
> Am I missing any step ? How can I receive data for column families 
> directly through REST
> 
> 
> 
> Thanks & Regards
> Stuti Awasthi
> Sr Specialist
> 
> 
> ________________________________
> ::DISCLAIMER::
> ----------------------------------------------------------------------
> -------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and 
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. 
> Any views or opinions presented in
> this email are solely those of the author and may not necessarily 
> reflect the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, 
> modification, distribution and / or publication of this message 
> without the prior written consent of the author of this e-mail is 
> strictly prohibited. If you have received this email in error please 
> delete it and notify the sender immediately.
> Before opening any mail and
> attachments please check them for viruses and defect.
> 
> ----------------------------------------------------------------------
> -------------------------------------------------
>

Re: Get query in REST for HBASE

Posted by Andrew Purtell <ap...@apache.org>.
Because keys in HBase are byte[], the REST interface base-64 encodes row key, column name, and the value if you choose XML representation. 


> Though I do receive timestamp, but rest of column familes(info:name and 
> info:age) are not sent as a response.


You say you are looking for two values. This result has two values in the row:


            <CellSet><Row key="Z2FnYW5zaA==">
value 1 ->  <Cell timestamp="1314870712846" column="aW5mbzphZ2U=">MzI=</Cell>
value 2 ->  <Cell timestamp="1314870952929" column="aW5mbzpuYW1l">Z2FnYW4=</Cell>
            </Row></CellSet>

So this looks probably correct. You need to run row key, column name, and value through a base 64 decoder, or choose a binary representation (using an Accept header in the request of either application/octet-stream, or application/x-protobuf).


Best regards,


        - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein (via Tom White)


----- Original Message -----
> From: Stuti Awasthi <st...@hcl.com>
> To: "user@hbase.apache.org" <us...@hbase.apache.org>
> Cc: 
> Sent: Thursday, September 1, 2011 8:41 PM
> Subject: Get query in REST for HBASE
> 
> Hi Friends,
> 
> 
> 
> I am trying to use  rest server and doing a query using : 
> http://localhost:8080/tablename/rowkey
> 
> This lists me   following output :
> 
> 
> 
> 
> 
> Though I do receive timestamp, but rest of column familes(info:name and 
> info:age) are not sent as a response.
> 
> Am I missing any step ? How can I receive data for column families directly 
> through REST
> 
> 
> 
> Thanks & Regards
> Stuti Awasthi
> Sr Specialist
> 
> 
> ________________________________
> ::DISCLAIMER::
> -----------------------------------------------------------------------------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and intended 
> for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. 
> Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect the 
> opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification, 
> distribution and / or publication of
> this message without the prior written consent of the author of this e-mail is 
> strictly prohibited. If you have
> received this email in error please delete it and notify the sender immediately. 
> Before opening any mail and
> attachments please check them for viruses and defect.
> 
> -----------------------------------------------------------------------------------------------------------------------
>