I am trying to post multiple columns / rows to my hbase cluster using the rest api. I can post 1 column at a time without trouble, but can't seem to get it to accept multiple columns / rows.
This works just fine
Data:
{
"Row":{
"@key":"www.somesite.com",
"Cell":{
"@column":"ColFam:Col1",
"$":"someData"
}
}
}
Call:
curl -v -X PUT -H "Content-Type: application/json" --data '{"Row": { "@key":"www.somesite.com", "Cell": { "@column":"ColFam:Col1", "$":"someData" } } }' http://somesite.com:8080/TestTable/www.somesite.com/ColFam:Col1
According to the api, I should be able to post multiple rows / columns at the same time though.
Multi Column Data:
{
"Row":
{
"key":"www.somesite.com",
"Cell":[
{
"column":"ColFam:Col1",
"$":"someData"
},
{
"column":"ColFam:Col2",
"$":"moreData"
}
]
}
}
Multi Row Data:
{
"Row":[
{
"key":"www.somesite.com",
"Cell":[
{
"column":"ColFam:Col1",
"$":"someData"
}
]
},
{
"key":"www.someothersite.com",
"Cell":[
{
"column":"ColFam:Col1",
"$":"moreData"
}
]
}
]
}
I tried using the following urls:
http://somesite.com:8080/TestTable/www.somesite.com/ColFam:Col1
http://somesite.com:8080/TestTable/www.somesite.com/ColFam
http://somesite.com:8080/TestTable/www.somesite.com
To no avail. The documentation says to use false-row-key so I also tried:
http://somesite.com:8080/TestTable/false-row-key
Still no luck.
I get the same error every time:
upload completely sent off: 124 out of 124 bytes
HTTP/1.1 503 Service Unavailable
Any Ideas?
So all you have to do is base64 encode all the json values.
{
"Row":[
{
"key":"d3d3LnNvbWVzaXRlLmNvbQ==",
"Cell":[
{
"column":"QXV0aG9yczp0ZXN0MQ==",
"$":"c29tZURhdGE="
},
{
"column":"QXV0aG9yczp0ZXN0Mg==",
"$":"bW9yZURhdGE="
}
]
}
]
}
This should have been obvious to me since the return values from the rest api are all base64 encoded.