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

amz-products

v0.0.3

Published

A thin wrapper for the Amazon Products API, supporting all methods on the API.

Downloads

6

Readme

AMZ Products

This module is a thin wrapper around the Amazon Products API. Unlike other modules, which only support one or two methods, this wrapper supports all the methods of the API.

The module is intentionally naive. It acts as a simple wrapper, allowing you to pass any valid options to the methods and returns the root response object from Amazon. I kept it this way, so you'll have the maximum flexibility in how you deal with responses.

Oh, and it returns JSON, not XML.

Installation

npm install amz-products

Usage

Each method takes an options hash as the first argument, and a callback as the second, which takes error and response arguments.


var AmazonAPI = require('amz-products');

var amazon = new AmazonAPI({
  accessKeyId     : //your access key,
  secretAccessKey : //your secret access key,
  associateId     : //your associate ID
});

amazon.getItemsInBrowseNode({
  BrowseNode: 1234566
}, function(err, res){
  //do something with the response here
});

Methods

All methods in the Amazon Products API have been mapped to this wrapper, but, I've renamed them slightly, since I think Amazon's naming sucks. Here's how things map:

Amazon API Method | Our Method --------------------|------------------ BrowseNodeLookup | lookupBrowseNode ItemSearch | getItemsInBrowseNode ItemLookup | getItemDetail CartAdd | addToCart CartClear | clearCart CartCreate | createCart CartGet | getCart CartModify | modifyCart SimilarityLookup | getSimilarItems

All methods take the same options as the Amazon API, in a single opts hash passed as the first argument in the method. Refer to the Amazon Products API Documentation for details on the options you can pass.

Locale Settings

The Product Advertising API support different locales, and so does this module. To use a different locale, simply pass the locale ID in when initializing the module. Example:


var AmazonAPI = require('amz-products');

var amazon = new AmazonAPI({
  accessKeyId: //your access key
  secretAccessKey: //your secret access key
  associateId: //your associate ID
  locale: 'UK'
});

The module defaults to "US", and passing a locale isn't required. Locale codes are as follows:

Locale | Code --------------|---------- Brazil | BR Canada | CA China | CN France | FR Germany | DE India | IN Italy | IT Japan | JP Mexico | MX Spain | ES United Kingdom| UK United States | US

Why Another Amazon Products API Module?

Frankly, all the ones I've come across on npm suck. Either they don't support all the methods, or they provide an arcane interface to the API. I'm passionate about developer experience, and want an API wrapper that makes sense, is fully featured, and is dead simple to use.

What Else?

Not much, really. If you've got ideas or suggestions for improving, create an issue or simply issue a pull request.