Skip to content

Latest commit

 

History

History
126 lines (122 loc) · 2.68 KB

README.md

File metadata and controls

126 lines (122 loc) · 2.68 KB

flipkart-affiliate-client

NPM version Build Status Baikal

NPM

un-official client for Flipkart Affiliates API

Installation

Install using npm:

npm install flipkart-affiliate-client

Usage

Require library

var affiliate = require('flipkart-affiliate-client');

Create client

var client = affiliate.createClient({
  FkAffId: '(affiliate_id)',
  FkAffToken: '(affiliate_token)',
  responseType: '(json or xml)'
});

Examples

examples based on usage

Category Feed

client.getCategoryFeed({
  trackingId: 'xxxxx'
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Product Feed

client.getProductsFeed({
  url: '(url obtained from Category Feed)'
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

Search Query based on Keywords

client.keywordSearch({
    query: "iphone",
    resultCount: "1"
  }, function(err, results){
    if(err){
      console.log(err);
    } else{
      console.log(results);
    }
});

Search Query based on Product

client.idSearch({
  id: "MOBDPPZZPXVDJHSQ"
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

All Offers

client.getAllOffers(null,function(err, resp){
  if(!err){
    console.log(resp);
  }else{
    console.log(err);
  }
});

Deals of the Day (DOTD) Offer

client.getDealsOfDay(null,function(err, resp){
  if(!err){
    console.log(resp);
  }else{
    console.log(err);
  }
});

Orders Report

client.getOrdersReport({
  startDate: '2015-10-22',
  endDate: '2016-02-04',
  status: 'cancelled',
  offset: '0'
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});

App Install Report

client.getAppInstReport({
  startDate: '2015-10-22',
  endDate: '2016-1-04',
  status: 'approved'
}, function(err, result){
    if(!err){
      console.log(result);
    }else {
      console.log(err);
    }
});