The Amazon Products Advertising API allows you to retrieve Amazon product information, including customer/seller reviews, images, prices, promotions and most of the information on Amazon's site pertaining to the products. Visitors to your site wishing to make a purchase can be directed to a virtual shopping cart that Amazon hosts on their servers and buy their products directly through Amazon. Additionally, you can earn revenue if you are a member of the Amazon Associates program and refer users to purchase products from Amazon through your site. Any way to generate passive income is a Good Thing.

I recently used this API to add a feature to an existing web app during the Legacy project at Hack Reactor. The app acted as a buyers club and utilized Venmo to facilitate the transfer of money between users when a certain threshold was met. I added the Amazon Products Advertising API to directly allow users to browse Amazon's products and buy the goods when the requisite funding was raised. You can add the Product Advertising API to your site by following these instructions:

The first thing you need to do is setup an Amazon Advertising Products API developer account by visiting this link, which can be linked with your Amazon retail account, if you are an Amazon customer.

You must also visit this Amazon AWS site and navigate to the Identity and Access Management (IAM) console to get your Amazon Access Key ID and Secret Access Key, which will be used to sign all of your requests. More on this later.

The API itself proved to be much more difficult than I anticipated. The latest version of the API was released in 2013, and the documentation was last updated June 24, 2014. All requests are made and returned in XML, and the process to create a proper request takes 10 steps. The request must be signed using a timestamp and the commas and colons must be URL encoded. Most importantly, a keyed-hash message authentication code (HMAC) must be created using the SHA256 hashing algorithm to sign the request before you can direct users to buy products from Amazon.

Fortunately for NPM users, there is a small library that will perform all of these functions for you, the Amazon Product Advertising API Client for Node (https://www.npmjs.com/package/apac) will parse our requests into XML, create the Request Signatures required by the Products API and parse the results to JSON for you. Although I spent too much unnecessary time researching the best method to accomplish all of this natively, you can reap the benefits as soon as you type npm install apac. And after you set up your AWS account, of course.

You only need to specify the type of action you want to take ('ItemSearch' or 'CreateCart', for instance) and an object that will contain the query parameters to be sent. The result will be parsed into JSON as an array of arrays, with each object property another array, leading to code that looks like this:

var item = results[index].ItemAttributes[0];  
var itemPrice = item.ListPrice ? item.ListPrice[0].FormattedPrice[0] :"N/A";  
$scope.imageURL = results[index].ImageSets[0].ImageSet[0].MediumImage[0].URL[0]

$scope.searchResults.push({
    'title': item.Title[0],
    'price': itemPrice,
    'img': results[index].ImageSets[0].ImageSet[0].MediumImage[0].URL[0],
    'description': results[i].EditorialReviews[0].EditorialReview[0].Content[0],
    'asin': results[index].ASIN[0]
});

I am currently preparing a pull request that converts the returned values to a more easily accessed object, though the repo has not been updated much since 2010.