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.

nodejs GET and PUT to HBASE

nodejs GET and PUT to HBASE

New Contributor

I was able to get integration between nodejs and HBASE rest api but have a problem with a couple things. Using the tutorial on :

http://blog.cloudera.com/blog/2013/03/how-to-use-the-apache-hbase-rest-interface-part-1

I can make a connection and a GET but would like to retrieve all the columns from a row. Now if I specify the column family and qualifier, it works but not when I try to retrieve all columns.

var request = require('request'); request('http://192.xxx.xxx.xxx:8080/table1/http%3A%2F%2Fkeyurl.com%2F', function (error, response, body) { console.log('error:', error); console.log('statusCode:', response && response.statusCode); console.log('body:', body); });
 error: null 
 statusCode: 400 
 body: Bad request: Either 0 or more than 1 columns specified. 

But if I specify the column family I get a return:

var request = require('request'); request('http://192.xxx.xxx.xxx:8080/table1/http%3A%2F%2Fkeyurl.com%2Fdomain_data%3Aurl%2F', function (error, response, body) { console.log('error:', error); console.log('statusCode:', response && response.statusCode); console.log('body:', body); });
]# node sample.js error: null statusCode: 200 body: http://keyurl.com/ 

Also if someone could help on how this PUT request returning an undefined response to trying to add a record.

 var request = require('request');
 request(
    'http://192.xxx.xxx.xxx:8080/maintable/http%3A%2F%2Ftesturl.com%2F',
    {
        method : 'PUT',
        json : {
            "Row": [
                {
                    "key":"aHR0cHM6Ly9tYWt6ZW9uLndvcmRwcmVzcy5jb20v",
                    "Cell": [
                        {
                            "column":"YmxvZ3NfZGF0YTp1cmw=",
                            "$": "aHR0cHM6Ly9tYWt6ZW9uLndvcmRwcmVzcy5jb20v"
                        },
                        {
                            "column":"YmxvZ3NfZGF0YTppbnNlcnREYXRl",
                            "$": "MTQ5Njg3ODk1OA=="
                        },
                        {
                            "column":"YmxvZ3NfZGF0YTpzdGF0dXM=",
                            "$": "QWN0aXZl"
                        }
                    ],
                }
            ]
        }
    },
    function (error, response, body) {
        console.log('error:', error);
        console.log('statusCode:', response && response.statusCode);
        console.log('body:', body);
    }
)



ERROR

error: null


statusCode: 200


body: undefined