Pranavesh S
Pranavesh S

Reputation: 76

Hbase REST call - getting junk characters " \x0A "

I'm trying to insert values into a Hbase table using the HBase REST API call.. Below is the curl command i'm using..

curl -v -XPUT 'http://localhost:8080/emp/1/pers:name' -H "Accept: application/json" -H "Content-Type: application/json" --data '{ "Row": [ { "Cell": [ { "column": "cGVyczpuYW1lCg==", "$": "TXlOYW1lCg==" } ], "key": "MQo=" } ] }'

The call works fine and I get a "HTTP/1.1 200 OK" .. But when i see the Hbase table, instead of updating the value in Row "1", the call creates a new row "1\x0A" and inserts the new value with the same junk characters..

1\x0A    column=pers:name\x0A, timestamp=1437596697507, value=MyName\x0A

Anyone seen something like this? Thanks in advance..

Upvotes: 2

Views: 1291

Answers (1)

Pranavesh S
Pranavesh S

Reputation: 76

Ok i sorted this out.. \x0A is the escaped hexadecimal Line Feed. The equivalent of \n.. When we base64 encode, it takes the \n escape character into account.. so we need to pass a " -n " when we base64 encode the rowkey, column and value..

For ex:

echo -n MyName | base64
TXlOYW1l
echo MyName | base64
TXlOYW1lCg==

There is a difference between the two.. and thats what caused my problem..

Upvotes: 2

Related Questions