Giter Club home page Giter Club logo

node-hasoffers's Introduction

build status

HasOffers API Wrapper for Node.js

This is an incomplete wrapper for the HasOffers API, documented here:

Required:

You will need to:

  1. set up a HasOffers account
  2. get API credentials
  3. whitelist your IP address (this can take a while)

More info at: http://hasoffers.com/

Installation

npm install hasoffers

Usage

Require the hasoffers package:

var HasOffers = require('hasoffers');

Instantiate and provide required authentication details options.

var ho = new HasOffers({
  NETWORK_ID: "YOUR_NETWORK_ID", // EX. jimscandy
  NETWORK_TOKEN: "YOUR_NETWORK_TOKEN", // EX. FGHEWOTIWEHTE2352351336q7
  HOSTNAME: "YOUR_API_HOSTNAME" // EX. "https://jimscandy.api.hasoffers.com"
});

From there you can do oh so many things. For example:

ho.validate(function(err, result, data){
  console.log(data); // true
});

will let you know that your credentials are valid and that your IP address has been whitelisted.

Other major parts of the API are wrapped for easy use, for example:

ho.offers.findAll(function(err, result, data){
  console.log(data); // all of your offers
});

Many calls have an optional 'options' parameter, where you can specify filters and pagination.

ho.reports.getConversions(["Stat.affiliate_info","Stat.id"], { page: 1 }, function(err, result, data){
  console.log(data); // page one of your conversion stats
});

If there's no explicit wrapper for the part of the API you want to use, you can either fork this repo and add it, or make your call the way grandpa used to do:

var params = {
  Target: "Goal",
  Method: "findAll",
  page: 1
};
ho.sendRequest(params, function(err, result, data){
  console.log(data); // the data you were looking for
});

node-hasoffers's People

Contributors

timisbusy avatar oveddan avatar

Watchers

James Cloos avatar cva78 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.