28

Is there a simple way to get book cover in JSON format from ISBN using Google Book API?

Kara
  • 6,115
  • 16
  • 50
  • 57
roxrook
  • 13,511
  • 40
  • 107
  • 156

2 Answers2

50

You can use the isbn: query, like this:

https://www.googleapis.com/books/v1/volumes?q=isbn:0771595158

This will return a proper JSON response containing either the book information or an error description if the ISBN is not found.

  • Thanks a lot. Simple enough ;) – roxrook Jan 20 '13 at 07:32
  • 1
    @Chan No problem. Just a bit of googling :) –  Jan 20 '13 at 07:33
  • It should be noted that you should not assume that when the JSON response contains the book information, `volumeInfo.imageLinks` will *always* be present. This is not the case. – Nick Jul 21 '14 at 18:31
  • 1
    When I search your link, returns me: { "error": { "errors": [ { "domain": "global", "reason": "unknownLocation", "message": "Cannot determine user location for geographically restricted operation." } ], "code": 403, "message": "Cannot determine user location for geographically restricted operation." } } – edonbajrami Feb 21 '15 at 18:24
  • 1
    The link in the answer is currently not providing a meaningful response. Here's one which does, with book cover images: https://www.googleapis.com/books/v1/volumes?q=isbn:9781461492986 – Ray Shan Jul 24 '17 at 16:44
  • It seems all ISBN requests returns the following response: `{"kind": "books#volumes", "totalItems": 0}` – Konstantin Konopko Aug 10 '18 at 14:14
  • @KonstantinKonopko what ISBN did you try? https://www.googleapis.com/books/v1/volumes?q=isbn:9781447929536 also works – OrigamiEye Apr 25 '19 at 14:10
  • @edonbajrami see https://stackoverflow.com/questions/54927398/google-books-api-cannot-determine-user-location-for-geographically-restricted – fisch May 13 '20 at 09:14
0

If you are looking for an answer for a Ruby (Rails, Sinatra or Console) answer on how to get a conver image or for that matter any detail available through the Google Books API, I think GoogleBooks gem is a good place to start.

For example, for the same scenario:

Install the gem

gem install googlebooks

Use the gem

require 'googlebooks'
GoogleBooks.search('isbn:9781443411080').first.image_link

first because it returns a collection of books.

Ziyan Junaideen
  • 3,270
  • 7
  • 46
  • 71