I'm doing a sort of shopping list web app in which you can link items to their Amazon's equivalent.
But I'm wondering how to do so. Is there any API? If so, is there a javascript API?
I'd like to:
a) Fetch an item image and description using their ASIN
b) Fetch search's results for a certain term.
Any suggestions/help is welcome!
Thanks!
A quick way to find the ASIN is to search for the item on Amazon and go to its product detail page. The ASIN will be printed on the page, as shown in Figure 1-3. If the ASIN can't be found anywhere on the page, you can always find it in the URL.
When creating a listing using Amazon's 'Add a Product' tool within your Seller Central account, you can search for existing ASINs by typing a product's name, model number, UPC, EAN or – if you already know it – the ASIN. This will show you the existing listings on Amazon.
ASIN (Amazon Standard Identification Number) is one of the unique product identifiers used for managing the Amazon product catalog. In a technical sense, it's a 10-digit code made up of numbers and letters.
You can do that by using node-apac, a node.js client for Amazon's Product Advertising API. However, to use the Amazon API you have to open a Amazon Web Services (AWS) account. Follow these steps.
Open a AWS account. Note: Amazon will ask you for a credit card on sign-up, but the Product Advertising API is free, so you won't be charged.
Login into your AWS account and go to Security Credentials page to find out your Access Key ID and Secret Access Key
Enroll into Amazon Associates Program and get your Associate Tag. This will allow you to receive commission from Amazon for the referrals you send to them.
Install node-apac
npm install apac@latest
Here is a code snippet that accomplishes your task b) for Amazon search query. It comes from the node-apac page, credit goes to dmcquay
var util = require('util'),
OperationHelper = require('apac').OperationHelper;
var opHelper = new OperationHelper({
awsId: '[YOUR ACCESS KEY ID HERE]',
awsSecret: '[YOUR SECRET ACCESS KEY HERE]',
assocId: '[YOUR ASSOCIATE TAG HERE]',
});
opHelper.execute('ItemSearch', {
'SearchIndex': 'Books',
'Keywords': 'harry potter',
'ResponseGroup': 'ItemAttributes,Offers'
}, function(error, results) {
if (error) { console.log('Error: ' + error + "\n"); }
console.log("Results:\n" + util.inspect(results) + "\n");
});
For the task a) of fetching an item image and description you do this:
opHelper.execute('ItemLookup', {
'ItemId': '[ASIN GOES HERE]',
'MechantId': 'All',
'Condition': 'All',
'ResponseGroup': 'Medium'
}, function(error, results) {
if (error) { console.log('Error: ' + error + "\n"); }
console.log("Results:\n" + util.inspect(results) + "\n");
});
That's it. Check the "results" object for the fields you need. It should include product images, description, and a lot more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With