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.
Hey this is cool info. Can you explain a bit more on how you acquired the author ASIN? I understand your last itemsearch request with the keyword=ID, but not quite sure how you get this ASIN. Thanks.
I pulled a few of them manually from Amazon. I haven’t been able to find a way to automate retrieving these in the way I would like.
Depending what you want to do, one option is to use the OpenLibrary API to look up an author by name, get the ISBNs of their books, and then look those up through the product API. I haven’t tried this yet, but I suspect there might be a way to get an ASIN that way (i.e. so you could get Amazon’s version of the list of all their books)