Select one or more hosts to serve the HBase Rest Server role. Click Continue.
Select the HBase Rest Server roles. Click Actions For Selected >
Start.
Using the REST API
The HBase REST server exposes endpoints that provide CRUD (create, read, update, delete) operations for each HBase process, as well as tables, regions, and
namespaces. For a given endpoint, the HTTP verb controls the type of operation (create, read, update, or delete).
These examples use port 20050, which is the default port for the HBase REST server when you use Cloudera Manager. If you use CDH without Cloudera Manager, the default port for the REST
server is 8080.
Cluster-Wide Endpoints
Endpoint
HTTP Verb
Description
Example
/version/cluster
GET
Version of HBase running on this cluster
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/version/cluster"
/status/cluster
GET
Cluster status
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/status/cluster"
/
GET
List of all nonsystem tables
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/"
Namespace Endpoints
Endpoint
HTTP Verb
Description
Example
/namespaces
GET
List all namespaces.
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/namespaces/"
/namespaces/namespace
GET
Describe a specific namespace.
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/namespaces/special_ns"
/namespaces/namespace
POST
Create a new namespace.
curl -vi -X POST \
-H "Accept: text/xml" \
"example.com:20550/namespaces/special_ns"
/namespaces/namespace/tables
GET
List all tables in a specific namespace.
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/namespaces/special_ns/tables"
/namespaces/namespace
PUT
Alter an existing namespace. Currently not used.
curl -vi -X PUT \
-H "Accept: text/xml" \
"http://example.com:20550/namespaces/special_ns"
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/regions"
Endpoints for Get Operations
Endpoint
HTTP Verb
Description
Example
/table/row/column:qualifier/timestamp
GET
Get the value of a single row. Values are Base-64 encoded.
Latest version:
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/row1"
Specific timestamp:
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/row1/cf:a/1458586888395"
Get the value of a single column. Values are Base-64 encoded.
Latest version:
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/row1/cf:a"
Specific version:
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/row1/cf:a/"
/table/row/column:qualifier?v=number_of_versions
Multi-Get a specified number of versions of a given cell. Values are Base-64 encoded.
curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:20550/users/row1/cf:a?v=2"
Endpoints for Scan Operations
Endpoint
HTTP Verb
Description
Example
/table/scanner/
PUT
Get a Scanner object. Required by all other Scan operations. Adjust the batch parameter to the number of rows the scan should return
in a batch. See the next example for adding filters to your Scanner. The scanner endpoint URL is returned as the Location in the HTTP response. The other examples in
this table assume that the Scanner endpoint is http://example.com:20550/users/scanner/145869072824375522207.
To supply filters to the Scanner object or configure the Scanner in any other way, you can create a text file and add your filter to
the file. For example, to return only rows for which keys start with u123 and use a batch size of 100:
Write a row to a table. The row, column qualifier, and value must each be Base-64 encoded. To encode a string, you can use the
base64 command-line utility. To decode the string, use base64 -d. The payload is in the --data argument, so the /users/fakerow value is a placeholder. Insert multiple rows by adding them to the <CellSet> element. You can also save the data to be inserted
to a file and pass it to the -d parameter with the syntax -d @filename.txt.