Node.js client for Moz API (MozScape)

I was doing some work with SEO domains and realised there wasn’t a node.js client for the MozScape API… so after Googling and not finding what I was looking for I built one.

What this basically does is provide SEO metrics on the URL you provide.

Here’s the download link:

Full code below:

var request = require("request");
var crypto = require('crypto');

// Get credentials from
mozAccessID = "mozscape-xxxxxxxxxx";
mozSecretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

mozExpires = parseInt(( / 1000).toFixed()) + 300;
console.log (mozExpires);
mozStringToSign = mozAccessID+"\n"+mozExpires;
//mozSig = crypto.createHmac('sha1', mozSecretKey).update(mozStringToSign).digest('hex');

mozSig = crypto.createHmac('sha1', mozSecretKey).update(mozStringToSign).digest('base64');
mozSafeSig = encodeURIComponent(mozSig);

mozURL = '';
mozCols = '103079247904'; // Learn more here:

mozRequest = ""+encodeURIComponent(mozURL)+"?Cols="+mozCols+"&AccessID="+mozAccessID+"&Expires="+mozExpires+"&Signature="+mozSafeSig;

request(mozRequest, function (error, response, body) {
// if (!error && response.statusCode == 200) {
// }

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *