Contact Us

Amazon Associates API (data source) for CakePHP

Posted on 31/7/08 by Felix Geisendörfer

Hey folks,

just wanted to let you know about a new addition to the debuggable scraps repository: An API for the Amazon Associates Web Service. Right now it's really just a simple wrapper to allow you to search their catalog since that was all I needed for now. But thanks to the almighty fork button on github you can easily change that ; ).

Using the API is as simple as:

class AmazonController extends AppController{
  var $uses = array();

  function index() {
    // Only needed if no Model has been loaded so far

    $amazon = ConnectionManager::getDataSource('amazon');
    $response = $amazon->find('DVD', array('title' => 'The Devil and Daniel Johnston'));

Documentation and code can be found here: Download the Amazon Associates API for CakePHP.

Hint: If you are looking for DVD covers you'll have to pass 'info' => 'Images' as a second query option.

Alright, hope that's useful to some of you out there : ),

-- Felix Geisendörfer aka the_undefined


You can skip to the end and add a comment.

rombeh  said on Aug 01, 2008:

interesting, as always. thanks for sharing, as always :)

Felix Geisendörfer said on Aug 04, 2008:

PHP4 Hater: I'm not impressed with the quality of their implementation and solving my own problem took me 30 minutes without getting me into a dependency with a library component that claims to be a framework and is 20 megs to download ... I'm happy : )

Jason kritikos  said on Nov 04, 2008:

Hi there,

I have found a bug in this implementation, but i think it actually is a bug in cake's reverse function. More specifically, you invoke it at the end of your function as follows:
$r = Set::reverse(new Xml($r));

I have found out that when you do ItemLookup queries in amazon, although there are multiple Actor elements and multiple Format elements, the php array i end up is always populated with all values in the Actor and Format tags..On the other hand, i end up with a single Format element. If you want email me and i ll send you all the code so you can try it yourself..



cakemate  said on Mar 05, 2009:

cool, will look at it and improve. what about the bug? which features to implement would be most important?

Felix Geisendörfer said on Mar 05, 2009:

cakemate: If you want to actively develop and maintain this let me know and I'll make sure to pull changes from you in GitHub.

Jason kritikos  said on Aug 18, 2009:

Hi again,

Just wanted to let you know that as of 15 august 2009 Amazon requires a new 'Signature' parameter. I ll try and get an update soon and post it here, but as I have very little time on my hands at the moment, i would really appreciate any feedback/solution on the matter.



Jason kritikos  said on Aug 18, 2009:

I found out a link which shows how to perform the signed request, I've already modified the datasource you provided us to reflect this. If anyone needs me to upload the new version let me know, otherwise check out


This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.