How to use restler - 10 common examples

To help you get started, we’ve selected a few restler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular-app / angular-app / server / lib / mongo-strategy.js View on Github external
MongoDBStrategy.prototype.query = function(query, done) {
  query.apiKey = this.apiKey;     // Add the apiKey to the passed in query
  var request = rest.get(this.baseUrl, { query: query });
  request.on('error', function(err, response) { done(err, null); });
  request.on('fail', function(err, response) { done(err, null); });
  request.on('success', function(data) { done(null, data); });
};
github EthanRBrown / web-development-with-node-and-express / ch15 / qa / tests-api.js View on Github external
test('should be able to retrieve an attraction', function(done){
        rest.post(base+'/attraction', {data:attraction}).on('success', function(data){
            rest.get(base+'/attraction/'+data.id)
				.on('success', function(data){
					assert(data.name===attraction.name);
					assert(data.description===attraction.description);
					done();
				})
				.on('error', function() {
					assert(false, 'Did you remember to alias api.meadowlark to 127.0.0.1 in your /etc/hosts file?');
				});
        });
    });
github BETaaS / BETaaS_Platform-Tools / betaas-utils / betaasconsole / server / modules / esModule.js View on Github external
function installService(res,url) {
rest.post(durl+':'+dport + pathinstall+"/"+url).
    on('complete', function (data, response) {
        console.log(data);
        console.log(response.statusCode);
        res.send(data);

    });
}
github kersten / vdr-guia / src.bak / mvc.js View on Github external
function checkVDRPlugins () {
        console.log('VDR check for plugins');
        
        rest.get(restfulUrl + '/info.json').on('complete', function(data) {
            vdr.plugins.epgsearch = false;

            for (var i in data.vdr.plugins) {
                vdr.plugins[data.vdr.plugins[i].name] = true;
            }

            setupBasics();
        });
    }
github martindale / snarl / bot.js View on Github external
Chat.find({}).sort('-timestamp').limit(1).exec(function(err, lastChat) {
              var now = new Date();
              var difference = ( now - lastChat.timestamp ) / 1000;
              if (difference >= 300) {
                rest.get('http://api.urbandictionary.com/v0/define?term='+token).on('complete', function(data) {
                  self.chat(data.list[0].definition);
                });
              }
            });
          }
github BETaaS / BETaaS_Platform-Tools / betaas-utils / betaasconsole / server / modules / esModule.js View on Github external
function checkService(res,url) {
    console.log('path will be '+durl+':'+dport + pathstatus+"/"+url);
    rest.get(durl+':'+dport + pathstatus+"/"+url).
    on('complete', function (data, response) {
        console.log(data);
        console.log(response.statusCode);
        res.send(data);

    });
}
github BETaaS / BETaaS_Platform-Tools / betaas-utils / betaasconsole / server / modules / esModule.js View on Github external
function stopService(res,url) {
    rest.get(durl+':'+dport + pathstop+"/"+url).
    on('complete', function (data, response) {
        console.log(data);
        console.log(response.statusCode);
        res.send(data);

    });
}
github BETaaS / BETaaS_Platform-Tools / betaas-utils / betaasconsole / server / modules / esModule.js View on Github external
function startService(res,url) {
   rest.get(durl+':'+dport + pathstart+"/"+url).
    on('complete', function (data, response) {
        console.log(data);
        console.log(response.statusCode);
        res.send(data);

    });
}
github HashBrownCMS / hashbrown-cms / plugins / hashbrown-driver / common / models / HashBrownDriverConnection.js View on Github external
return new Promise((resolve, reject) => {
            restler.post(this.getRemoteUrl() + '/hashbrown/api/content/tree?token=' + this.settings.token, {
                headers: headers,
                data: json
            })
            .on('success', (data, response) => {
                resolve(data);
            })
            .on('fail', (data, response) => {
                reject(data);
            });
        });
    }
github EdgeVerve / oe-cloud / lib / expression-language / expression-ast-parser.js View on Github external
ast.ExecRuleStatementNode.prototype.build = function ExecRuleStatementNodeBuild(indent, indentChar, obj, options) {
    var deferred = q.defer();

    var ruleEngineApi = app.get('ruleEngine');
    var api = ruleEngineApi + '?name=' + this.name;
    restler.post(api, {
      data: obj.instance.__data
    }).on('complete', function handleResponse(data, response) {
      deferred.resolve(data);
    });

    return deferred.promise;
  };

restler

An HTTP client library for node.js

MIT
Latest version published 9 years ago

Package Health Score

51 / 100
Full package analysis

Popular restler functions