Amazon.com : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)
The JDisplay Java Applet displays the large program listings on this web page. JDisplay requires an up-to-date browser and Java version 1.8+, preferably 1.8.0_131. If you can’t see the listings, or if you just want to learn more about JDisplay, click  Help Use Firefox for best results.

Amazon logo Amazon Product Advertising API
Introduction FetchBookFacts
AWS Programmer API IsASINInStock
Types of Links Amazon in India
Other Countries Tips
Sample Code For Amazon AWS Links
AwsHandlerResolver

Introduction

Amazon.com keeps a database of all its products including books, electronics and DVDs (Digital Video Discs). an enormous online bookstore that carries many Java related books. It includes pictures and prices, but not detailed descriptions. Each country has its own separate database. They sometimes use the same ASIN number for the same product. You can use this data to embed links to Amazon stores on your own webpage. When people buy products you get a small commission.

Types Of Links To the Amazon Websites

On the mindprod.com website, I use a variety of affiliate links to the Amazon.com website:

Types of Links To Amazon.com

text link

to a specific book
Java Concurrency in PracticeJava Concurrency in Practice

image link

to a specific book

CMP (Canadian Mind Products) Book Macros

book cover recommend book⇒Programming Amazon Web Services: S3, EC2, SQS, FPS and SimpleDBto book home
by James Murty 978-0-596-51581-2 paperback
publisher O’Reilly recommended 978-0-596-55179-7 eBook
published 2008-04-01 B004OR1JF0 kindle

It covers:

  • S3 : online storage to store and retrieve data
  • EC2 : online computing to be able to run jobs on a farm of machines
  • SQS : web messaging infrastructure for computer-computer communication
  • FPS : flexible payment system for moving money online
  • SimpleDB : store and retrieve datasets online

It is about doing your computing by renting Amazon servers. It is not about using the AWS Amazon Product Advertising API to do book referrals.

Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒Java Concurrency in Practiceto book home
by Brian Goetz, Tim Peierls, Joshua J. Bloch, Joseph Bowbeer, David Holmes, Doug Lea 978-0-321-34960-6 paperback
publisher Addison-Wesley 978-0-13-270225-6 eBook
published 2006-05-19 B004V9OA84 kindle
Bloch and Lea especially have very good reputations in concurrent programming. This is the dream team to write such a book.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.

AWS (Amazon Web Services) Programmer API (Application Programming Interface)

Screen scraping will drive you insane at Amazon because the pages are formatted inconsistently, they make ever increasing use of JavaScript and they change the layouts frequently just to keep things interesting.

Thankfully, they have created a programmer’s API. called AWS or more recently the PA-API (Product Advertising Application Programming Interface). Actually there are dozens of dozens of them actually, to let you do all manner of things including getting the information about a book in computer-friendly and reasonably stable form — XML (extensible Markup Language) / SOAP (Simple Object Access Protocol). Each country has its own servers, own accounts, own passwords, own XML schema… Unfortunately for batch processes, they don’t want you to do more than 200 inquiries per hour. Oddly, the problem is too much documentation and too many samples. You are overwhelmed. Don’t try to make sense of the complicated stuff until you gave found introductory docs and mastered the basics. Read the Getting Started Guide materials first. To help avoid overloading Amazon’s servers, find a response format that includes just what you need. Amazon issues you user IDs and passwords to use on all queries so they can track what you are up to with the API. They also insist that all queries be digitally signed and sent with HTTPS (Hypertext Transfer Protocol over SSL (Secure Socket Layer)). You can sign by computing your own RFC 2104-compliant HMAC-SHA256 digital signature, or you can use Oasis WSS (Web Services Security) SOAP -Style signing, using your own X.509 certificate or one provided by Amazon. I guess they are preparing for a sophisticated DOS (Denial of Service attack) attack.

To use it you will need:

You don’t need AWS SDK (Software Development Kit). All you need is AWSECommerceService.wsdl, and Java’s built-in JAX features.

There is a utility called the Amazon Product Advertising API Signed Requests Helper that helps you understand how queries are constructed. It sorts the parameters alphabetically, adds a timestamp and digitally signs the request to form a GET URL (Uniform Resource Locator). It is a little out of date. The URLs it uses do not match those in the JAX spec. Here is what a typical query looks like:

Fields to use in your inquiries you may find of interest include:

Fields of interest in the responses include:

You do not directly specify which fields you can in response, but you can specify constellations of names called ResponseGroups.

The XML response has a complex tree structure, it is not just a matter of requesting the field you want.

You can batch up to ten queries in on request.

They also have SDK s for half a dozen languages. I don’t know much about it.

Other Countries

The endpoints/servers can be accessed with http: or https:.
Country Port Name Endpoint
Canada https://webservices.amazon.ca/onca/soap AWSECommerceServicePortCA
China https://webservices.amazon.cn/onca/soap AWSECommerceServicePortCN
France https://webservices.amazon.fr/onca/soap AWSECommerceServicePortFR
Germany https://webservices.amazon.de/onca/soap AWSECommerceServicePortDE
Great Britain https://webservices.amazon.co.uk/onca/soap AWSECommerceServicePortUK
Italy https://webservices.amazon.it/onca/soap AWSECommerceServicePortIT
Japan https://webservices.amazon.jp/onca/soap AWSECommerceServicePortJP
Spain https://webservices.amazon.es/onca/soap AWSECommerceServicePortES
USA https://webservices.amazon.com/onca/soap AWSECommerceServicePort or AWSECommerceServicePortUS

You don’t use SNI (Server Name Indication). You must have Symantec Class 3 Secure Server CA - G4 root cert installed in your JVM (Java Virtual Machine).

The web is littered with obsolete lists of the endpoint URLs. You can find the most recent list inside AWSECommerceService.wsdl. You don’t use the endpoints directly unless you are experimenting with Amazon Product Advertising API Signed Requests Helper. Otherwise you use the corresponding port getter e.g. AWSECommerceService.getAWSECommerceServicePortCA() or AWSECommerceServicegetAWSECommerceServicePort() ; and JAX looks effectively looks up the corresponding end point in AWSECommerceService.wsdl (using pre-generated code). Note that Amazon in Spain (Amazon.es) and Amazon in India (Junglee.com) originally did not support AWS, but now it does do. Unlike the other Amazon stores, Junglee will not let you register as an affiliate unless you are resident of India. I suspect they will not let you probe their AWS database either. Amazon in Australia (Amazon.com.au), Amazon in Brazil (Amazon.com.br) and Amazon in Mexico (Amazon.com.mx) still do not. Amazon in Australia and Amazon in Mexico have no paper books or electronics, just kindles and kindle eBooks. I don’t include them on my site book referrals.

TestItemSearch: Sample Code For Amazon AWS API

It took weeks to get this little sample program to use the Amazon AWS API working. Even the Signed Requests Helper utility took days to get working. The problem is Amazon makes their API more and more complicated each year, but do not update the documentation and they refuse to provide complete example code. I have never in my career of 55 years seen a more incompetently documented API. Further, the API is not consistent. Further, it is often idiotic, e.g. returning the number of results as a BigInteger when even a short would have done fine.

It uses SSL (Secure Sockets Layer) but not SNI. You must have the root certificate for Symantec Class 3 Secure Server CA - G4 installed in your cacerts.

AwsHandlerResolver

I downloaded this AwsHandlerResolver code from the Amazon website, then modified it to use the more compact CMP Base64 classes. AwsHandlerResolver handles the poorly documented stuff like adding a timestamp, digitally signing your request and Base64 ASCII-armouring the signature.

FetchBookFacts

The following is a more complicated example. You give it an ISBN-13 (aka EAN (European Article Number) ) on the command line and it probes the Amazon API to find the title, author, publisher, published date. It also probes for the ISBN-13s of alternate bindings, e.g. Paperback, Hardcover, Kindle, Audio. It creates a text file (in the form of an HTML (Hypertext Markup Language) macro) summarising this information and downloads the large bookcover image. It does not include the author birth/death dates since Amazon does not track them. On my website, those fields are added later by code part of HTMLMacros.

view

IsASINInStock

The following takes either an isbn13 or ASIN and probes the Amazon.com AWS API to find out if the product is in stock. The results do not correspond well with the information on the website. I don’t know which is actually correct.

Amazon in India

Amazon in India is puzzling. Instead of being called Amazon.in they called it Junglee.com. You could not probe its inventory with AWS using getAWSECommerceServicePortIN even though that port was defined in the to AWSECommerceService.wsdl file. You had to screen scrape the consumer interface. You could not sign up as an affiliate unless you lived in India. I get perhaps a third of my traffic from India, but I was still excluded. To my surprise, Junglee had the largest inventory of any Amazon store.

Then on 2014-08-23 a new, separate website appeared called Amazon.in alongside Junglee.com without any explanation of its relationship to Junglee.com.

I tried to contact Amazon.in via their website for clarification. They refused to talk to me unless I provided them with a fake cell number. They asked me a number of impertinent questions, then to cap it off gave me no space to pose my questions. I am soured on them already.

Tips


This page is posted
on the web at:

http://mindprod.com/jgloss/amazonproductadvertising.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\amazonproductadvertising.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.238.79.169]
You are visitor number