[ 
https://issues.apache.org/jira/browse/HBASE-7129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439575#comment-16439575
 ] 

Dequan Chen commented on HBASE-7129:
------------------------------------

To [~mdrob],


Thanks for your comment the other day. I just double-checked the checkAndPut 
examples in both xml- and json-format. They are correct and different from the 
regular Put. I will explain the json example as follows with the purpose that 
you and others can fully understand how the checkAndPut examples work:

curl -vi -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d 
'\{"Row":[{"key":"cm93MQ==","Cell":[{"column":"Y2ZhOmFsaWFz","$":"T2xkR3V5"},\{"column":"Y2ZhOmFsaWFz",
 "$":"TmV3R3V5"}] }]}' \
"http://example.com:8000/users/row1/?check=put";

In the above json-format example: 
(1) \{"column":"Y2ZhOmFsaWFz", "$":"TmV3R3V5"} at the end of -d option are the 
check cell name and check cell value in Base-64 respectively: "Y2ZhOmFsaWFz" 
for "cfa:alias", and "TmV3R3V5" for "NewGuy". 
(2) \{"column":"Y2ZhOmFsaWFz","$":"T2xkR3V5"} are the new Put cell name and 
cell value in Base-64 respectively: "Y2ZhOmFsaWFz" for "cfa:alias", and 
"T2xkR3V5" for "OldGuy".
(3) "cm93MQ==" is the Base-64 for "row1" for the checkAndPut row key
(4) "/?check=put" after the "row key' in the request URL is required for 
checkAndPut WebHBase operation to work
Note: "cfa" is the column family name and "alia" are the column (qualifier) 
name for the non-Base64 encoded cell name.

Basically, the xml-format example is the same as the json-format example, I 
will not duplicate here.

In addition, can you tell me how to change all the values in monospaced font in 
the patch. Thanks.

I hope that the above explanation can help.

Have a Good Day!

Dequan

 

> Need documentation for REST atomic operations (HBASE-4720)
> ----------------------------------------------------------
>
>                 Key: HBASE-7129
>                 URL: https://issues.apache.org/jira/browse/HBASE-7129
>             Project: HBase
>          Issue Type: Improvement
>          Components: documentation, REST
>            Reporter: Joe Pallas
>            Assignee: Dequan Chen
>            Priority: Minor
>              Labels: beginner
>         Attachments: HBASE-7129.0001.patch, HBASE-7129.0002.patch, 
> HBASE-7129.patch
>
>
> HBASE-4720 added checkAndPut/checkAndDelete capability to the REST interface, 
> but the REST documentation (in the package summary) needs to be updated so 
> people know that this feature exists and how to use it.
> http://wiki.apache.org/hadoop/Hbase/Stargate
> http://hbase.apache.org/book/rest.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to