For book lovers who have a liking for a specific genre, they will probably check out a friend’s recommendation than follow any bestseller list. This is why Amazon’s Goodreads is a bookmarked site for avid readers. It’s a place where you can find an extensive database of books, recommendations and reviews by fellow book lovers.
Goodreads also provides an API for developers to access its data and further personalize it as per our application. Today we’ll see how to retrieve Goodreads book ratings through the Goodreads API using the ISBN or International Standard Book Number, which can later be used while displaying book information and such on your website.
To begin, either login or sign up with a name, email id and password to Goodreads and go to https://www.goodreads.com/api/keys (link). Enter any application name and company name and generate your API key. Then verify your account through the email received in the email id you entered.
If you want the rating of the Head First Java, First Edition book, it’s in myJSON.books.average_rating. The ratings_count and reviews_count keys in the objects represent the total number of ratings cast and reviews made for that particular edition of the book.
Similarly , text_reviews_count represents the total text-only reviews of the particular edition of the book. Whereas work_ratings_count, work_reviews_count and work_text_reviews_count represent the total ratings, reviews and text-only reviews of all the editions.
You can use all those extra review information if you’d like or just display a star rating for the book using the average_rating key value.
Note: According to the API documenation, “The Goodreads API gives you full access to Goodreads-owned meta-data, but it does not give you full access to book meta-data supplied by third parties such as Ingram. Book cover images, descriptions, and other data from third party sources might be excluded, because we do not have a license to distribute these data via our API.”
Once you’ve readied the book covers and descriptions, you can display the book info somewhat like below.