Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including moz-api with all npm packages installed. Try it out:

var mozApi = require("moz-api")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

moz-api v1.2.6

A lightweight javascript API wrapper for the Moz API

moz-api

Coverage Status Build Status

Moz Link API wrapper written in javascript for node applications (can also run in the browser). Fetch link data and other metrics from various endpoints, including Url Metrics, Top Page Metrics, and others. The Link API is a paid plan, they offer a limited free version to the API as well.

Installation

npm install --save moz-api

Motivation

Sending requests directly to the api is tedious with the various bit masks that needs to be calculated for filtering as well as signing the request for authentication. We also didn't find any currently maintained projects available. This seemed like a good opportunity to build a simple to use interface.

Usage / Examples


var Moz = require('moz')

// initialize and configure client
const moz = new Moz({
  accessId: ACCESS_ID, 
  secretKey: SECRET_KEY
});

// fetch url metrics for moz.com
// return promise
moz.urlMetrics
  .fetch('moz.com', {
    cols: ['Title', 'Domain Authority'],
  })
  .then((response) => {
    console.log(response.data)
  })
  .catch((error) => {
    console.error(error.response.data)
  })



Compatibility

Depedencies

Resources

License

This library is licensed under MIT. See LICENSE.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free