You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Suraj Varma <sv...@gmail.com> on 2013/05/14 19:15:00 UTC
Re: Examples of Multi Get and Multi Put using Stargate (JSON)
*Moving your post to user mailing list.*
Here are more examples: http://wiki.apache.org/hadoop/Hbase/HbaseRest
For your curl calls, escape your ampersands, else it is interpreted by your
shell as a command to run in the background.
curl -v -H "Accept: application/json"
http://hostname:9999/testjson/multiget/?row=row1\&row=row2<http://hostname:9999/testjson/multiget/?row=row1&row=row2>
For your PUT call, usually this error is thrown if your file contents don't
match your Content-Type. Check again if your file is indeed formatted
correctly. From the HbaseRest link above:
- HTTP 200 (OK) if the column(s) could successfully be saved. HTTP 415
(Unsupported Media Type) if the query string column options do not match
the Content-type header, or if the binary data of either octet-stream or
Multipart/related is unreadable
--Suraj
On Tue, May 14, 2013 at 9:04 AM, Vandana Ayyalasomayajula <
avandana@yahoo-inc.com> wrote:
> Hi All,
>
> I am trying to find some examples involving multi-get and multi-put using
> stargate but couldn't get any.
> I am following this page:
>
> http://wiki.apache.org/hadoop/Hbase/Stargate
>
> For multi-put, I tried the following:
>
> curl -v -X PUT -H "Accept: application/json"
> http://hostname:9999/testjson/false-row-key --data @./data.txt
> * About to connect() to hostname port 9999 (#0)
> * Trying 98.137.97.185... connected
> * Connected to hostname (98.137.97.185) port 9999 (#0)
> > PUT /testjson/row3 HTTP/1.1
> > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4
> OpenSSL/0.9.8r zlib/1.2.5
> > Host: hostname:9999
> > Accept: application/json
> > Content-Length: 271
> > Content-Type: application/x-www-form-urlencoded
> >
> < HTTP/1.1 415 Unsupported Media Type
> < Content-Length: 0
> <
> * Connection #0 to host hostname left intact
> * Closing connection #0
>
> For multi-get I tried the following:
>
> curl -v -H "Accept: application/json"
> http://hostname:9999/testjson/multiget/?row=row1&row=row2
>
> The above command only returns the first row.
>
> If somebody has used the above operations successfully using REST, it
> would be of great help to
> share the details.
>
> Thanks
> Vandana
>
>
Re: Examples of Multi Get and Multi Put using Stargate (JSON)
Posted by Vandana Ayyalasomayajula <av...@yahoo-inc.com>.
Thanks Suraj for the pointer.
I have the following in my data file:
{
"Row":[
{
"key":"row3",
"Cell":[
{
"column":"data:test",
"$":"value2"
},
{
"column":"data:test2",
"$":"value3"
}
]
}
]
}
and there seem to no examples of multi-put anywhere. I searched the code for unit tests and there seem to be none.
Thanks
Vandana
On May 14, 2013, at 10:15 AM, Suraj Varma wrote:
> *Moving your post to user mailing list.*
>
> Here are more examples: http://wiki.apache.org/hadoop/Hbase/HbaseRest
>
> For your curl calls, escape your ampersands, else it is interpreted by your
> shell as a command to run in the background.
>
> curl -v -H "Accept: application/json"
> http://hostname:9999/testjson/multiget/?row=row1\&row=row2<http://hostname:9999/testjson/multiget/?row=row1&row=row2>
>
> For your PUT call, usually this error is thrown if your file contents don't
> match your Content-Type. Check again if your file is indeed formatted
> correctly. From the HbaseRest link above:
>
> - HTTP 200 (OK) if the column(s) could successfully be saved. HTTP 415
> (Unsupported Media Type) if the query string column options do not match
> the Content-type header, or if the binary data of either octet-stream or
> Multipart/related is unreadable
>
> --Suraj
>
>
> On Tue, May 14, 2013 at 9:04 AM, Vandana Ayyalasomayajula <
> avandana@yahoo-inc.com> wrote:
>
>> Hi All,
>>
>> I am trying to find some examples involving multi-get and multi-put using
>> stargate but couldn't get any.
>> I am following this page:
>>
>> http://wiki.apache.org/hadoop/Hbase/Stargate
>>
>> For multi-put, I tried the following:
>>
>> curl -v -X PUT -H "Accept: application/json"
>> http://hostname:9999/testjson/false-row-key --data @./data.txt
>> * About to connect() to hostname port 9999 (#0)
>> * Trying 98.137.97.185... connected
>> * Connected to hostname (98.137.97.185) port 9999 (#0)
>>> PUT /testjson/row3 HTTP/1.1
>>> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4
>> OpenSSL/0.9.8r zlib/1.2.5
>>> Host: hostname:9999
>>> Accept: application/json
>>> Content-Length: 271
>>> Content-Type: application/x-www-form-urlencoded
>>>
>> < HTTP/1.1 415 Unsupported Media Type
>> < Content-Length: 0
>> <
>> * Connection #0 to host hostname left intact
>> * Closing connection #0
>>
>> For multi-get I tried the following:
>>
>> curl -v -H "Accept: application/json"
>> http://hostname:9999/testjson/multiget/?row=row1&row=row2
>>
>> The above command only returns the first row.
>>
>> If somebody has used the above operations successfully using REST, it
>> would be of great help to
>> share the details.
>>
>> Thanks
>> Vandana
>>
>>