Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of categories in Google Books API?

I was searching for an already answered question about this but couldn't find one so please forgive me if I somehow missed it.

I'm using Google Books API and I know I can search a book by specific category.

My question is, how can I get all the available categories from the API? I looked in the API documentation but couldn't find any mention of this.

like image 314
Avihoo Mamka Avatar asked Jan 03 '23 20:01

Avihoo Mamka


2 Answers

The Google books api does not have an end point for returning Categories that are not associated with a book itself.

The Google Books api is only there to list books. You can

  • search and browse through the list of books that match a given query.
  • view information about a book, including metadata, availability and price, links to the preview page.
  • manage your own bookshelves.

You can see the category of a book you can not get a list of available categories in the whole system

You may be interested to know this has been on their todo list since 2012 category list

We have numerous requests for this and we're investigating how we can properly provide the data. One issue is Google does not own all the category information. "New York Times Bestsellers" is one obvious example. We need to first identify what we can publish through the API.

work around

i worked around it by implementing my own category list mechanism so i can pull all categories that exists in my app's database. (unfortunately, the newly announced ScriptDb deprecation means my whole system will go to waste in a couple of monthes anyway... but that's another story)

like image 150
DaImTo Avatar answered Jan 05 '23 15:01

DaImTo


https://support.google.com/books/partner/answer/3237055?hl=en

Scroll down to subject/genres and you will see this link.

https://bisg.org/page/bisacedition

This list is apparently a list of subjects AKA categories for North American Books. I am making various GET requests with an API testing tool and getting for the most part, perfect matches (you may have to drop a word from the query string. ex: "criticism" instead of "literary criticism") for whatever subject I choose from the BISG subjects list, and what comes back in the json response under the "categories" key.

Ex: GET https://www.googleapis.com/books/v1/volumes?q=business+subject:juvenile+fiction

Long story short, the BISG link is where I'm pretty sure Google got all the options for their "categories" key from.

like image 25
Kuda Avatar answered Jan 05 '23 17:01

Kuda