简体   繁体   中英

Get Amazon item images and description from ASIN

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!

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.

  1. 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.

  2. Login into your AWS account and go to Security Credentials page to find out your Access Key ID and Secret Access Key

  3. 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.

  4. Install node-apac

     npm install apac@latest 
  5. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM