[ This chapter does not appear in the book. ]
This chapter describes programming techniques for writing standalone programs that employ Web-based service APIs. As a test-bed, I'll implement an application which sends a book title to a service, and gets back a PNG image of the book's cover. I'll write five versions: one each for Google, Amazon, and eBay, and two aimed at Yahoo. There's a high degree of commonality between them, since they all pass through five stages:
These stages are shown in the diagram at the top of this page, which I'll refer to using the mnemonic BSRPE.
There's usually also a step 0 – the programmer signs up with the Web service to obtain an application ID, and perhaps a password or secret key. The ID and password are included in the URL created during stage 1.
For more complicated searches, the five stages frequently occur twice. The first time they comprise a search phase where the user supplies a list of criteria in the URL, and the resulting data structure contains possible matches. A lookup phase follows, which also has five stages, where more information is obtained for a particular match.
The service APIs that I employ are:
These services offer multiple language interfaces, including JavaScript, PHP, and Flash, but I'll utilize their Java versions so I can write standalone applications that doesn't require a Web browser.
Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page