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

amazon-paapi

v1.0.7

Published

Amazon Associate Product Advertising API for NodeJs. A PAAPI 5.0 Extension.

Downloads

7,067

Readme

amazon-paapi

npm version NPM

Amazon Associate Product Advertising API for NodeJs. A PAAPI 5.0 Extension.

A clean wrapper for amazon's NodeJs SDK. Main purpose of this module is to jumpstart development with easy to understand and clean syntax inspired with the amazon scratchpad-like operation.

Amazon Product API

Installation

npm install amazon-paapi --save

Quickstart

const amazonPaapi = require('amazon-paapi');

const commonParameters = {
  AccessKey: '<YOUR  ACCESS  KEY>',
  SecretKey: '<YOUR  SECRET  KEY>',
  PartnerTag: '<YOUR  PARTNER  TAG>', // yourtag-20
  PartnerType: 'Associates', // Default value is Associates.
  Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};

const requestParameters = {
  ASIN: 'B07H65KP63',
  Resources: [
    'ItemInfo.Title',
    'Offers.Listings.Price',
    'VariationSummary.VariationDimension',
  ],
};

/** Promise */
amazonPaapi
  .GetVariations(commonParameters, requestParameters)
  .then((data) => {
    // do something with the success response.
    console.log(data);
  })
  .catch((error) => {
    // catch an error.
    console.log(error);
  });

Usage

const amazonPaapi = require('amazon-paapi');

const commonParameters = {
  AccessKey: '<YOUR  ACCESS  KEY>',
  SecretKey: '<YOUR  SECRET  KEY>',
  PartnerTag: '<YOUR  PARTNER  TAG>', // yourtag-20
  PartnerType: 'Associates', // Default value is Associates.
  Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};

GetBrowseNodes

Lookup information for a Browse Node. Please see sample script here.

const requestParameters = {
  BrowseNodeIds: ['3040', '3045'],
  LanguagesOfPreference: ['es_US'],
  Resources: ['BrowseNodes.Ancestor', 'BrowseNodes.Children'],
};

/** Promise */
amazonPaapi
  .GetBrowseNodes(commonParameters, requestParameters)
  .then((data) => {
    // do something with the success response.
    console.log(data);
  })
  .catch((error) => {
    // catch an error.
    console.log(error);
  });

GetItems

Lookup item information for an item. Please see sample script here.

Note: This operation only supports ASIN as id Type. If you need to lookup using UPC or EAN, you can do so under SearchItems operation.

const requestParameters = {
  ItemIds: ['B00X4WHP5E', 'B00ZV9RDKK'],
  ItemIdType: 'ASIN',
  Condition: 'New',
  Resources: [
    'Images.Primary.Medium',
    'ItemInfo.Title',
    'Offers.Listings.Price',
  ],
};

/** Promise */
amazonPaapi
  .GetItems(commonParameters, requestParameters)
  .then((data) => {
    // do something with the success response.
    console.log(data);
  })
  .catch((error) => {
    // catch an error.
    console.log(error);
  });

GetVariations

Lookup information for variations. Please see sample script here.

const requestParameters = {
  ASIN: 'B07H65KP63',
  Resources: [
    'Images.Primary.Medium',
    'ItemInfo.Title',
    'Offers.Listings.Price',
    'VariationSummary.VariationDimension',
  ],
};

/** Promise */
amazonPaapi
  .GetVariations(commonParameters, requestParameters)
  .then((data) => {
    // do something with the success response.
    console.log(data);
  })
  .catch((error) => {
    // catch an error.
    console.log(error);
  });

SearchItems

Searches for items on Amazon. Please see sample script here.

const requestParameters = {
  Keywords: 'Harry Potter',
  SearchIndex: 'Books',
  ItemCount: 2,
  Resources: [
    'Images.Primary.Medium',
    'ItemInfo.Title',
    'Offers.Listings.Price',
  ],
};

/** Promise */
amazonPaapi
  .SearchItems(commonParameters, requestParameters)
  .then((data) => {
    // do something with the success response.
    console.log(data);
  })
  .catch((error) => {
    // catch an error.
    console.log(error);
  });

Common Request Parameters

  • AccessKey - An alphanumeric token that uniquely identifies you. For information about getting an Access Key, see Register for Product Advertising API.
  • SecretKey - A key that is used in conjunction with the Access Key to cryptographically sign an API request. To retrieve your Access Key or Secret Access Key, refer Register for Product Advertising API.
  • PartnerTag - An alphanumeric token that uniquely identifies a partner. In case of an associate, this token is the means by which Amazon identifies the Associate to credit for a sale. If the value for PartnerType is Associate, specify the store ID or tracking ID of a valid associate store from the requested marketplace as the value for PartnerTag. For example, If store-20 and store-21 are store id or tracking id of customer in United States and United Kingdom marketplaces respectively, then customer needs to pass store-20 as PartnerTag in all PAAPI requests for United States marketplace and store-21 as PartnerTag in all PAAPI requests for United Kingdom marketplace. To obtain an Partner Tag, see Sign up as an Amazon Associate.
  • PartnerType - The type of Amazon program. For more information on valid values, refer PartnerType Parameter.
  • Marketplace - Default value is US. Note: Host and Region are predetermined based on the marketplace value. There's is no need for you to add Host and Region as soon as you specify correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.

V4.0 to V5.0 Mapping

Due to major change from V4.0 to V5.0, most of the legacy application may not work properly since V4.0 is not supported anymore.

We're currently working on mapping some commonly used operations from the V4.0 and make it available soon to work with the V5.0.

In the mean time, please check amazon documentation on how to map.

FAQ

  • What are the available resources I can add in the parameter? Please refer to this page.

  • How can I do itemLookup using a UPC or EAN? You can lookup using searchItems operation. Add your UPC or EAN under the keyword parameter. More details here.

  • What if I included an invalid ASIN value in ASIN array parameter? You will get an error response but the result of the valid ASINs are still included in the response data. Please refer to the last portion of this page.

  • Is the addCart Operation still supported in V5.0? It is deprecated, But you can use Add to Cart form to integrate cart on your websites.

Donation

If this somehow makes your job a bit easier, please consider dropping few bucks. Your contribution allows me to spend more time improving features of this project.

Donate

License

MIT