Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

looking for curl PUT command syntax for hbase

Highlighted

looking for curl PUT command syntax for hbase

Master Collaborator

I have this syntax for GET but I am cant find the syntax for PUT

curl --negotiate -i -u : -X GET -H "Accept: text/xml" http://$(hostname):17001/UFM/schema/
8 REPLIES 8
Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator

tried this syntax but does not work , table is 'test' and column family is 'cf1'

 curl --negotiate -X PUT -H "Accept: text/xml" -H "Content-Type: text/xml" -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><CellSet><Row key="cm93NQo="><Cell column="Y2Y6Y2YxCg==">dmFsdWU1Cg==</Cell></Row></CellSet>' "http://hadoop1:17001/test/fakerow"

Highlighted

Re: looking for curl PUT command syntax for hbase

@Sami Ahmad

Could you confirm if you are using the hbase rest? As described here:

https://wiki.apache.org/hadoop/Hbase/HbaseRest

Please let me know so I can help you here.

Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator
yes I am ..
[hbase@hadoop1 ~]$ curl --negotiate -u : 'http://hadoop1:17001/namespaces'
Sami
default
hbase
Highlighted

Re: looking for curl PUT command syntax for hbase

Super Guru

@Sami Ahmad When using HBase rest api, i often use this for a reference :

https://gist.github.com/karmi/1218928

For example, to do a put execute the following:

curl -v -X PUT \  'http://localhost:8080/test/row1/data:test' \  -H "Accept: application/json" \  -H "Content-Type: application/json" \  -d "{\"Row\":{\"@key\":\"$KEY\",\"Cell\":{\"@column\":\"$COLUMN\", \"$\":\"$DATA\"}}}"

Sunile -

When an "Answer" addresses/solves your question, please select "Accept" beneath that answer. This encourages user participation in this forum.

Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator

what are values for $KEY $COLUMN and $DATA ? what is data:test ? is it columnfamily:column ?

Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator

i used the encoded base64 values for KEY COLUMN and DATA as follows still no luck . if I use either of the syntax command just hangs

[hbase@hadoop1 ~]$ curl --negotiate -X PUT \  'http://hadoop1:17001/test/fakerow' \ -H "Accept: text/json" \ -H "Content-Type: application/json" \ -d "{\"Row\":{\"@key\":\"cm93NQo=\", \"Cell\":{\"@column\":\"Y2YxOmUK\", \"$\":\"dmFsdWU1Cg==\"}}}"

^C
[hbase@hadoop1 ~]$ curl --negotiate -X PUT -u : \  'http://hadoop1:17001/test/fakerow' \ -H "Accept: text/json" \ -H "Content-Type: application/json" \ -d "{\"Row\":{\"@key\":\"cm93NQo=\", \"Cell\":{\"@column\":\"Y2YxOmUK\", \"$\":\"dmFsdWU1Cg==\"}}}"
^C


Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator

here is the base64 decoded values of the three variables .

[hbase@hadoop1 ~]$ echo cm93NQo= | base64 -d
row5
[hbase@hadoop1 ~]$ echo Y2YxOmUK | base64 -d
cf1:e
[hbase@hadoop1 ~]$ echo dmFsdWU1Cg== | base64 -d
value5
[hbase@hadoop1 ~]$

Highlighted

Re: looking for curl PUT command syntax for hbase

Master Collaborator
Sunile can you kindly reply ?
Don't have an account?
Coming from Hortonworks? Activate your account here