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.
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.
Share Improve this question edited Feb 16, 2023 at 20:21 starball 50.4k32 gold badges202 silver badges883 bronze badges asked Jul 29, 2012 at 3:10 Tommy B.Tommy B. 3,63914 gold badges63 silver badges110 bronze badges3 Answers
Reset to default 15 +50You 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.
https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html
In addition to Arik G's comment on the node-apac api, you can use the full Node.js library for AWS to get access to product search, etc. http://aws.amazon.com/code/Product-Advertising-API/4272.
As Judge Mental mentions, the affiliate main page had a list of resource which have documentation and a developer guide. I find using the ScratchPad very useful for testing that I have the correct Account keys or making sample queries.