Here is my example - it lets you search for music, dvds, books, etc by title (and an artist for music cds, and an author for books) and then shows the resulting images ordered into 5 different image sizes. Double click an image to open the jpg in a new window.
** As Amazon keeps updating their web service this example will stop working. Please view the source code to see how it used to work!
Here are the steps to get it working in your Flex Builder:
- Download the source code from the example above (Right click "View Source", then click the download link in the bottom left corner of the page)
- Sign up for an Amazon Web Service Account
- Copy your Access Key ID and put it in the services/AmazonItemSearch.as file
- Full details and the API for the Amazon Web Services are located here
I found this website which helped me get started:
Finding cover art with Flex and Amazon WebServices.
** August 24th, 2009 Update **
As of August 15th Amazon now requires that all requests are signed. The example above has been updated to include this change, so you can View Source to see the code.
Here are some links that I found very useful in fixing the problem:
- Getting Started - submitting your first request
- Example REST Requests (steps on how to sign the request)
- Signed Request Helper:
Use 00000000000000000000 for the access key and 1234567890 for the secret key.
Then copy the following text into the Unsigned URL textbox:http://webservices.amazon.com/onca/xml?Service=AWSECommerceServic
When signing the request, I tried using the com.adobe.crypto.HMAC and com.adobe.crypto.SHA256 classes that come with the as3corelib project to create the signature, but it didn't work because the signature needs to be Base64 encoded. So instead I modified those two classes very slightly to make it work.
I also included a TestSignature.mxml application which was useful to make sure that the signature matched what the Signed Request Helper output.