How to use restler

Comprehensive restler code examples:

How to use restler.post:

119
120
121
122
123
124
125
126
127
128
        requestOption.data = body;
        requestOption.headers['content-type'] = 'application/json';
}
  
switch(type.toLowerCase()){                     
        case 'post': restRequest = restler.post(url + '?u=0&xt=' + this.cookies['xt'], requestOption);
          break;
        default : restRequest = restler.get(url, requestOption);
}
  

How to use restler.parsers:

117
118
119
120
121
122
123
124
125
126
}

function getStockProfileFromBenzinga(symbol, callback) {
  symbol = utils.normalizeSymbol(symbol);
  var options = {
    parser: restler.parsers.json
  };
  restler.get('http://data.benzinga.com/stock/'+symbol, options).on('complete', function(result) {
    var profile;
    var stock;

How to use restler.request:

30
31
32
33
34
35
36
37
38
39
  options.headers['Content-Type'] = 'application/json';
}

options.parser = rest.parsers.json;

rest.request(this.url(url), options).addListener('success', function(data) {
  p.emitSuccess(data);
}).addListener('error', function(data) {
  p.emitError(data);
});

How to use restler.get:

119
120
121
122
123
124
125
126
127
128
function getStockProfileFromBenzinga(symbol, callback) {
  symbol = utils.normalizeSymbol(symbol);
  var options = {
    parser: restler.parsers.json
  };
  restler.get('http://data.benzinga.com/stock/'+symbol, options).on('complete', function(result) {
    var profile;
    var stock;
    if (result instanceof Error) {
      callback(result);