Skip to content

Instantly share code, notes, and snippets.

@emilkaiser
Created December 9, 2014 13:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emilkaiser/95c1241fc7dff35086dc to your computer and use it in GitHub Desktop.
Save emilkaiser/95c1241fc7dff35086dc to your computer and use it in GitHub Desktop.
Booli API Node.js
var http = require('http');
var querystring = require('querystring');
var crypto = require('crypto');
var shasum = crypto.createHash('sha1');
var auth = {};
auth.callerId = "YOUR_CALLER_ID";
auth.time = Math.round(Date.now() / 1000);
auth.unique = crypto.randomBytes(Math.ceil(16/2)).toString("hex").slice(0, 16);
auth.hash = shasum.update(auth.callerId + auth.time + "YOUR_PRIVATE_KEY" + auth.unique).digest("hex");
var url = "http://api.booli.se/listings/?q=nacka&" + querystring.stringify(auth);
http.get(url, function (res) {
console.log(res.statusCode);
var body = "";
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
console.log(JSON.parse(body));
});
});
@mrdanne
Copy link

mrdanne commented Dec 14, 2017

Hej,
Jag försöker få till och lista detta på min Joomlahemsida men jag fattar inte exakt hur jag ska göra. Skulle du kunna förklara lite hur jag gör? När jag lägger booli.php och sen går till den så visas bara koden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment