Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of ALL offers from Amazon Product Advertising API

Tags:

I need to be able to get a listing of all offers for a product using the amazon API. This is the request I'm sending:

http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Operation=ItemLookup&SubscriptionId=&AssociateTag=&Version=2011-08-01&ItemId=B007IJQDQQ&IdType=ASIN&ResponseGroup=Offers&Condition=All&MerchantId=All 

This is returning the follow under offers:

<Offers> <TotalOffers>1</TotalOffers> <TotalOfferPages>1</TotalOfferPages> <MoreOffersUrl> http://www.amazon.com/gp/offer-listing/B007IJQDQQ%3FSubscriptionId%3DAKIAJTZ6VROOTPJAPPWQ%26tag%3Damazoautom-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB007IJQDQQ </MoreOffersUrl> <Offer> <OfferAttributes> <Condition>New</Condition> </OfferAttributes> <OfferListing> <OfferListingId> TR5sygI0VR7cwy3Hg0DBHwgCWFnkqXLyCR70jjMhy1h8gWlEisKYt5cqDbS2Fu1SEqDtfBILdxYDziJdFzfsqMpPJkBqcYV3DFovHx1nXWRy9wHS6CFZXknBvsCo1bxYS%2BsxAeYrZHrS6g6aakEJQA%3D%3D </OfferListingId> <Price> <Amount>375</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$3.75</FormattedPrice> </Price> <AmountSaved> <PercentageSaved>56</PercentageSaved> <Availability>Usually ships in 1-2 business days</Availability> <AvailabilityAttributes> <IsEligibleForSuperSaverShipping>0</IsEligibleForSuperSaverShipping> </OfferListing> </Offer> </Offers> 

As you can see it only returns the 1 offer even though it says there are 3 new offers. Does anyone know of a way to get all the offers and not just the lowest one? Merchant ID='ALL' doesn't do it, neither do any of the other response groups like offerFull, offerSummary, or offers.

like image 302
Gregory Billings Avatar asked Jan 07 '13 22:01

Gregory Billings


People also ask

How do I get access to the Amazon Product Advertising API?

Step 1: After signing into your Amazon Associates account, select Tools from the navigation bar. After selecting Tools, select Product Advertising API from the dropdown. Step 2: Scroll to the Put the Advertising API to Work for You section and select Join.

Does Amazon have an API for their products?

Yes. Amazon has an API for Amazon Web Services. Amazon provides their API for each framework and language like PHP, Java, . NET, RUBY and many more.

Is Amazon API free?

With Amazon API Gateway, you only pay when your APIs are in use. There are no minimum fees or upfront commitments. For HTTP APIs and REST APIs, you pay only for the API calls you receive and the amount of data transferred out.

What is API in Amazon affiliate?

Advanced Users. Product Advertising API. The Product Advertising API provides programmatic access to Amazon's product selection and discovery functionality so that developers can integrate Amazon products directly into your website.


1 Answers

After doing some research this not possible in the API, however you can parse the HTML of the standard page to get the details:

1) Use http://simplehtmldom.sourceforge.net/ for parsing HTML (If your not using php, you'll need find something similar)

2) CURL (make sure you set your header or amazon will error) both http://www.amazon.com/gp/offer-listing/B007IJQDQQ/?condition=new and http://www.amazon.com/gp/offer-listing/B007IJQDQQ/?condition=used

3) To handle pages count total number of offers (found #new span.numberreturned) and divide by 15 to work out number of pages.

4) You'll need to parse each page, URLs would be like some:

eg page 2 http://www.amazon.com/gp/offer-listing/B005IMB5SG/?condition=used&startIndex=15

eg page 3 http://www.amazon.com/gp/offer-listing/B005IMB5SG/?condition=used&startIndex=30

Hope this is enough info to get you started, sorry I don't have access to the working script I wrote a while ago.

like image 60
dciso Avatar answered Sep 24 '22 20:09

dciso