Moz
installation
npm install mozscape-request
Documentation
Basic Usage
Require the module and pass your options
var moz = accessId: '<YOUR ACCESSID>' secret: '<YOUR SECRET>' expires: 300 // Optional, default set to 300 ;
Available options:
- accessId {string} : Mozscape access id
- secret {string} : Mozscape secret
- url {string} [optional] : Api url, Default: http://apiv2.ahrefs.com/,
- expires {boolean} [optional] : Expires delay, Default: 300
Build and run a query
var query = moz target'http://moz.com' cols'canonical_url' 'external_links' 'root_domains_linking' 'moz_rank_url' moz;
Result contains the response of the mozscape API. Check the documentation of each endpoint to get the key corresponding to the parameter you have passed.
Batch mode
To use the batch mode, simply pass an array to the targets
method. Batch mode request use POST method.
Note: Batch mode is currently working only on the url-metrics endpoint
var query = moz target'http://moz.com' 'http://optimiz.me' cols'canonical_url' 'external_links' 'root_domains_linking' 'moz_rank_url' moz;
Metadata
Metadata request are done in a similar fashion:
moz; // Which is the short for: var query = moz target'last_update'; moz;
Flags
Use the bitsToFlags method to translate a bitflags sum to an array of flags:
var query = moz target'http://moz.com' moz;
Run tests
You must specify your token to run the test suite:
ACCESSID="<ACCESSID>" SECRET="<SECRET>" npm test
You can also run the tests agains your own target if needed (default is moz.com
):
TARGET=<YOUR TARGET> ACCESSID="<ACCESSID>" SECRET="<SECRET>" npm test
Generate API documentation
npm run-script doc
Todo:
- Support request frequency rate
Special Thanks
Developed for Optimiz.me, an online software designed to help working the SEO optimisation of your web site, by yourself, without the need of technical knowledge.
Développé pour Optimiz.me un logiciel en ligne conçu pour aider à travailler l'optimisation du référencement de votre site web, par vous-même, sans besoin de connaissances techniques.