REST Service for HBASE Notes:
GET /
-retrieves a list of all the tables with their meta data in HBase
curl -v -H "Accept: text/xml" -X GET -T - http://localhost:60050/
curl -v -H "Accept: application/json" -X GET -T - http://localhost:60050/
POST /
-Create a table
curl -H "Content-Type: text/xml" -H "Accept: text/xml" -v -X POST -T - http://localhost:60050/newTable
test14
subscription
2
NONE
false
true
Response:
200success
JSON:
curl -H "Content-Type: application/json" -H "Accept: application/json" -v -X POST -T - http://localhost:60050/newTable
{"name":"test5", "column_families":[{
"name":"columnfam1",
"bloomfilter":true,
"time_to_live":10,
"in_memory":false,
"max_versions":2,
"compression":"",
"max_value_length":50,
"block_cache_enabled":true
}
]}
*NOTE* this is an enum defined in class HColumnDescriptor.CompressionType
GET /[table_name]
-returns all records for the table
curl -v -H "Accept: text/xml" -X GET -T - http://localhost:60050/tablename
curl -v -H "Accept: application/json" -X GET -T - http://localhost:60050/tablename
GET /[table_name]
-Parameter Action
metadata - returns the metadata for this table.
regions - returns the regions for this table
curl -v -H "Accept: text/xml" -X GET -T - http://localhost:60050/pricing1?action=metadata
Update Table
PUT /[table_name]
-updates a table
curl -v -H "Content-Type: text/xml" -H "Accept: text/xml" -X PUT -T - http://localhost:60050/pricing1
subscription
3
NONE
false
true
subscription1
3
NONE
false
true
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -T - http://localhost:60050/pricing1
{"column_families":[{
"name":"columnfam1",
"bloomfilter":true,
"time_to_live":10,
"in_memory":false,
"max_versions":2,
"compression":"",
"max_value_length":50,
"block_cache_enabled":true
},
{
"name":"columnfam2",
"bloomfilter":true,
"time_to_live":10,
"in_memory":false,
"max_versions":2,
"compression":"",
"max_value_length":50,
"block_cache_enabled":true
}
]}
Delete Table
curl -v -H "Content-Type: text/xml" -H "Accept: text/xml" -X DELETE -T - http://localhost:60050/TEST16
creating a scanner
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X POST -T - http://localhost:60050/TEST16?action=newscanner
//TODO fix up the scanner filters.
response:
xml:
2
json:
{"id":1}
Using a scanner
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X POST -T - "http://localhost:60050/TEST16?action=scan&scannerid=&numrows="
Closing a scanner
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X POST -T - "http://localhost:60050/TEST16?action=closescanner&scannerid="
ROW OPERATIONS
fetch a single row
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X GET -T - "http://localhost:60050/pricing1/FADAA09_20080930000000_something-with-a-dash-and-a-space_1229121022233"
delete a single row
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X DELETE -T - "http://localhost:60050/pricing1/FADAA09_20080930000000_something-with-a-dash-and-a-space_1229121022233"
Update/insert a row
curl -v -H "Content-Type: application/json" -H "Accept: application/json" -X POST -T - "http://localhost:60050/pricing1/rowname"
{[{
"column_name":"other",
"value":"test1",
}
]}
curl -v -H "Content-Type: text/xml" -H "Accept: text/xml" -X POST -T - "http://localhost:60050/pricing1/rowname"
//TODO write the input xml
CELL OPERATIONS
fetch a single cell
curl -v -H "Accept: text/xml" -X GET -T - "http://localhost:60050/pricing1/rowname/columnname"
query string of ?numversions=
Delete a single cell
curl -v -H "Accept: text/xml" -X DELETE -T - "http://localhost:60050/pricing1/rowname/columnname"
Update/insert a cell
curl -v -H "Accept: text/xml" -X POST -T - "http://localhost:60050/pricing1/rowname/columnname"
The value can be inserted without any xml/json surrounding it
TIMESTAMP OPERATIONS