I'm using curl to access Hbase with REST. I'm having a problem in inserting data into Hbase. I followed the Stargate documentation but when I follow the same syntax it gives me 400/405 errors of Bad requests and Method not Allowed errors. I have pasted the command below. Please tell me where am I going wrong.
Stargate documentation says
POST /<table>/<row>/<column> (:qualifier)?/<timestamp>
curl -H "Content-Type: text/xml" --data '[...]' http://localhost:8000/test/testrow/test:testcolumn
My curl command is as follows:
curl -H "Content-Type: text/xml" --data '[<CellSet><Row key="111"><Cell column="f1">xyz</Cell></Row></CellSet>]' http://localhost:8080/mytable/row/fam
What is the right way to do this? because this gives me Bad request error.
Also, Im trying the same in a Python client.It gives me ColumnFamilyNotFoundException.I am reading the Xml data that is to be passed to the stargate server from a file.The code is as follows.
url = 'http://localhost:8080/mytable/row/fam'
f = open('example.xml', 'r')
xmlData = f.read()
r = requests.post(url, data=xmlData, headers=headers)
example.xml has the following:
<CellSet>
<Row key="111">
<Cell column="fam:column1">
xyz
</Cell>
</Row>
</CellSet>
It was a very simple mistake. Hbase expects every value in base64 encoding. Tha key as well as columnfamily:column has to be base64 encoded before entering in the xml.