hadoophbasestargate

How to insert data into HBase through StarGate REST API


According to the StarGate documentation, this is how a CURL command should look like:

% curl -H "Content-Type: text/xml" --data '[...]' http://localhost:8000/test/testrow/test:testcolumn

This is what I'm trying:

% curl -X POST -H "Accept: text/xml" --data '[<CellSet><Row key="cm93MQ=="><Cell column="dGl0bGU6YQ==">d29ya2Vk</Cell></Row></CellSet>]' http://localhost:8080/test/row1/title

Keep getting HTTP 415, Unsupported Media Type.. any ideas what I'm missing there?


Solution

  • Your current curl options specify you'd like XML output, and curl is assuming you are posting url-encoded form data (and specifying the wrong Content-Type in the HTTP headers).

    Amend your -H "Accept: text/xml" to -H "Content-Type: text/xml" and you should be good