retailer-api-helper

1.0.3 • Public • Published

This module contains helper functions for more easily accessing the Inventory Source Retailer API.


Installation

npm install retailer-api-helper --save

Boilerplate

import RetailerAPI from "retailer-api-helper";
var retailerAPI = new RetailAPI(
  client_id, // Replace with your Client ID
  client_secret, // Replace with your Client Secret
  refresh_token // Replace with your refresh token
);

Example Replacements

In example/src/store/reatiler/index.js

 

Note: This API will handle all refresh token calls if the current access token expires.

Usage

Get Products

Returns all products since the last product id pulled:since_id.

// Pagination Approach
retailerAPI.getProducts({
  since_id: "424254", // Last id fetched from get
  page_size: "100",   // Page Size of products returned
  catalog_id: "5310", // ID of the catalog we are getting the products
}).then(products => {});

Response: Products


Get Channels

Returns all channels that are connected to this retailer through api.

retailerAPI.getChannels().then(channels => {});

Response: Channels


Get Catalogs

Returns all catalogs the retailer has.

retailAPI.getCatalogs().then((catalogs) =>{});

Response: Catalogs


Get Shipments

Returns only shipped order details.

retailAPI.getShipments({
    channel_id,     // The channel the order was ordered on
    order_id        // The Id of the order
}).then((shipments) =>{});

Response: Shipments


Create Order

Creates a new order.

retailerAPI
  .createOrder({
      order: {}// See Documentation for details ( Too Complex to Display )
  })
  .then((order, err) => {
    if (err) {
      console.log(err);
    } else {
      // Successfully created order
    }
  });

Request/Response: Order


For more information on the retailer api, visit: https://isretailerapiv1.docs.apiary.io/

Readme

Keywords

none

Package Sidebar

Install

npm i retailer-api-helper

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

27.2 kB

Total Files

18

Last publish

Collaborators

  • gopro16