Gary Sieling

Retrieve all books for an author from the Amazon Product API

The Amazon Product API has an “Author” field, which is a nearly useless (and decidedly misleading) field to filter books on, because it only allows text based filtering. Clearly, however, Amazon assigns internal IDs to authors (you can see an author page here).

Each of these pages has an “ASIN” (the Amazon internal ID). If you use the “ItemLookup” API, it will return you the author’s name, and indicate that the ID is a non-purchasable item.

You might then think that because the API appears to allow you to search on relationships, like tracks for a CD, episodes in a TV show, and the like, that you’d be able to do this to get books for an author. As far as I can tell this isn’t possible, although clearly it should be.

However, once you get this ASIN, you can do a regular search for it, and get all the books back.

let id = 'B001H6L6JA';

const options = {
  Keywords: id,
  SearchIndex: 'Books',
  ItemPage: 2
  ResponseGroup: 'Large'
}; 

prodAdv.call(
  'ItemSearch', options, 
  (err, result) => {
    console.log(
      JSON.stringify(result, null, 2)
    );
  }
);

You can confirm that this works as well by just using the Amazon search UI to do the same thing, i.e. search Amazon.com for this ASIN and you will get all of the author’s books back.

Note that I’ve included the paging parameters as well, just so you can see how to do this.

Exit mobile version