HBASE-17962 Improve documentation on Rest interface

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Niels Basjes 2017-04-26 11:21:39 +02:00 committed by Sean Busbey
parent 03e8f6b56e
commit fc68f23a48
2 changed files with 13 additions and 4 deletions

View File

@ -139,7 +139,13 @@ public class RowResource extends ResourceBase {
if (!rowspec.hasColumns() || rowspec.getColumns().length > 1) {
servlet.getMetrics().incrementFailedGetRequests(1);
return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
.entity("Bad request: Either 0 or more than 1 columns specified." + CRLF).build();
.entity("Bad request: Default 'GET' method only works if there is exactly 1 column " +
"in the row. Using the 'Accept' header with one of these formats lets you " +
"retrieve the entire row if it has multiple columns: " +
// Same as the @Produces list for the get method.
MIMETYPE_XML + ", " + MIMETYPE_JSON + ", " +
MIMETYPE_PROTOBUF + ", " + MIMETYPE_PROTOBUF_IETF +
CRLF).build();
}
MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
try {

View File

@ -225,14 +225,17 @@ creation or mutation, and `DELETE` for deletion.
|Description
|Example
|/_table_/_row_/_column:qualifier_/_timestamp_
|/_table_/_row_
|GET
|Get the value of a single row. Values are Base-64 encoded.
|Get all columns of a single row. Values are Base-64 encoded. This requires the "Accept" request header with a type that can hold multiple columns (like xml, json or protobuf).
|curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:8000/users/row1"
curl -vi -X GET \
|/_table_/_row_/_column:qualifier_/_timestamp_
|GET
|Get the value of a single column. Values are Base-64 encoded.
|curl -vi -X GET \
-H "Accept: text/xml" \
"http://example.com:8000/users/row1/cf:a/1458586888395"