I am making an app to search for books using Amazon sdk, but I'm having trouble understanding how to get books by genre.


Literature and criticism

Literary work
Historical and historical novels
Economic and social novels
Mystery suspense hard boiled
Science Fiction/Horror/Fantasy

There are categories and genres in Amazon books.
I want to specify that only the elements of "literary work" of this "genre_child" are to be acquired.

At present, the method of acquiring "5" products in the category "Books" with the name "Rails" has been successful.

# Specify keywords
$keyword = 'Rails';
/ *
 * Specify the category in which search request is to be made
 * For more details, refer: https://webservices.amazon.com/paapi5/documentation/use-cases/organization-of-items-on-amazon/search-index.html
 * /
$searchIndex = "Books";
# Specify item count to be returned in search result
$itemCount = 5;

I would love to hear from anyone who knows how to get genre elements.

  • Answer # 1

    A unique BrowseNodeId is attached to each category (genre in this case).
    You can specify this ID when searching.
    How to check ID? The only way to look at Amazon in a browser is to checknode = ???of the URL ...
    Large categories are summarized in the old document, but new categories are increasing, so it is impossible to examine all of them.

    From here you can see node = 465392, so 465392 is ID

  • Answer # 2

    If the Amazon API has this function, you can use it.
    Of course, it may be necessary to narrow down to only the desired genre after obtaining it with the API.