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
    App::import('ConnectionManager');

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

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

 
&nsbp;