npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cake-affiliate-api

v0.0.3

Published

Cake Affiliate API for Node.js

Downloads

5

Readme

CAKE Affiliate API for Node.js

CAKE is SaaS platform providing marketing intelligence for perforfmance marketers (LinkedIn). These guys have many different APIs thus they provide big marketing platform. This module covers Affiliate APIs group.

Requirements

  • CoffeeScript installed globally (for cake build)

Installation

npm install cake-affiliate-api --save

Example

'use strict'

var CakeAffiliateAPI = require('cake-affiliate-api')
  , options
  , client

options = {
  "apiKey":      "MY_API_KEY",
  "affiliateId": "100500",
  "baseUrl":     "https://cake.coolnetwork.com",
  "rawResponse": true
}

client = new CakeAffiliateAPI(options)

client.offerFeed({offerStatusId: 3}, handleResult)

function handleResult(err, data) {
  if (err) {
    // handle error...
  }
  else {
    handleData(data)
  }
}

API

Keep in mind that every API option which is passed in camelcase is underscored before making HTTP call. So it's OK to name options like mediaTypeCategoryId (converted to media_type_category_id).

addLinkCreative(campaignId, data, callback)

data options:

  • creativeName (required)
  • offerLink (required)
  • description defaults to null

applyForOffer(offerContractId, data, callback)

data options:

  • mediaTypeId (required)
  • notes defaults to null
  • agreedToTerms defaults to false
  • agreedFromIpAddress (required)

creativeFeed(exportFeedId, updatesSince, callback)

getCampaign(campaignId, callback)

getCreativeCode(campaignId, creativeId, callback)

getCreativeTypes(callback)

getFeaturedOffer(callback)

getMediaTypeCategories(callback)

getOfferStatuses(callback)

getPixelTokens(callback)

getSubAffiliates(query, callback)

query options:

  • startAtRow defaults to 1
  • rowLimit defaults to 0

getSupressionList(offerId, callback)

getTags(callback)

getVerticalCategories(callback)

getVerticals(callback)

offerFeed(query, callback)

query options:

  • campaignName defaults ''
  • mediaTypeCategoryId defaults to 0
  • verticalCategoryId defaults to 0
  • verticalId defaults to 0
  • offerStatusId defaults to 0
  • tagId defaults to 0
  • startAtRow defaults to 1
  • rowLimit defaults to 0

sendCreativePack(campaignId, creativeId, contactId, callback)

setPixel(campaignId, pixelHtml, callback)

setPostbackURL(campaignId, postbackURL, callback)

setTestLink(campaignId, testLink, callback)

Options

  • apiKey defaults to null

  • affiliateId defaults to null

    • Affiliate Id. Read documentation above.
  • baseUrl defaults to null

    • API endpoint of CAKE-based network.
  • rawResponse defaults false

    • If true xml2js is not called for XML response and it's returned as string.
  • parser defaults to null

    • Should be a function like parse(xmlString, callback) where callback accepts (err, response)
  • xml2jsOptions defaults to {explicitArray: false}

    • Options passed to xml2js.parseString(). If specified will overwrite defaults. Also if specified, client won't try to process response smartly (i.e. if response outputs collection it will return raw xml2js output instead of array).

FAQ

Why module is writted on CoffeeScript but compiled to JavaScript after npm install?

I really like CoffeeScript for fast module development but dislike when people do something like this:

require('coffee-script');
require('./module.coffee');

Why should we do this if in the end all is compiled to JavaScript? :wink:

TODO

  • Implement ALL APIs