Google Books API JSON and ISBN / VolumeID

jonboy picture jonboy · Nov 4, 2014 · Viewed 10.9k times · Source

I have 3000+ books, some with ISBN numbers and some without. I am trying to get a their thumbnail images (possibly subtitle & author) from a JSON file using Google API search queries.

I have noticed that each search query produces different JSON files - is this normal? The VolumeID query seems to be return a more detailed JSON? I have included the relevant JSON files below.

Setup = Win7, localhost, apache, php, chrome.

The isbn: query:

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

Which returns the following JSON;

{
 "kind": "books#volumes",
 "totalItems": 1,
 "items": [
  {
   "kind": "books#volume",
   "id": "beSP5CCpiGUC",
   "etag": "cNL3l6PTv24",
   "selfLink": "https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC",
   "volumeInfo": {
    "title": "The 1989 World Book year book",
    "subtitle": "a review of the events of 1988 ; the annual supplement to the World book encyclopedia",
    "authors": [
     "Robert O. Zeleny"
    ],
    "publishedDate": "1989-02-01",
    "industryIdentifiers": [
     {
      "type": "ISBN_10",
      "identifier": "0716604892"
     },
     {
      "type": "ISBN_13",
      "identifier": "9780716604891"
     }
    ],
    "readingModes": {
     "text": false,
     "image": false
    },
    "pageCount": 576,
    "printType": "BOOK",
    "categories": [
     "Reference"
    ],
    "contentVersion": "preview-1.0.0",
    "imageLinks": {
     "smallThumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=5&source=gbs_api",
     "thumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=1&source=gbs_api"
    },
    "language": "en",
    "previewLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&dq=isbn:0716604892&hl=&cd=1&source=gbs_api",
    "infoLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&dq=isbn:0716604892&hl=&source=gbs_api",
    "canonicalVolumeLink": "http://books.google.co.uk/books/about/The_1989_World_Book_year_book.html?hl=&id=beSP5CCpiGUC"
   },
   "saleInfo": {
    "country": "GB",
    "saleability": "NOT_FOR_SALE",
    "isEbook": false
   },
   "accessInfo": {
    "country": "GB",
    "viewability": "NO_PAGES",
    "embeddable": false,
    "publicDomain": false,
    "textToSpeechPermission": "ALLOWED",
    "epub": {
     "isAvailable": false
    },
    "pdf": {
     "isAvailable": false
    },
    "webReaderLink": "http://books.google.co.uk/books/reader?id=beSP5CCpiGUC&hl=&printsec=frontcover&output=reader&source=gbs_api",
    "accessViewStatus": "NONE",
    "quoteSharingAllowed": false
   }
  }
 ]
}

The volumeId query;

https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC

I get the following JSON;

{
 "kind": "books#volume",
 "id": "beSP5CCpiGUC",
 "etag": "Zx4P5cYhhLU",
 "selfLink": "https://www.googleapis.com/books/v1/volumes/beSP5CCpiGUC",
 "volumeInfo": {
  "title": "The 1989 World Book year book",
  "subtitle": "a review of the events of 1988 ; the annual supplement to the World book encyclopedia",
  "authors": [
   "Robert O. Zeleny"
  ],
  "publisher": "World Book",
  "publishedDate": "1989-02-01",
  "industryIdentifiers": [
   {
    "type": "ISBN_10",
    "identifier": "0716604892"
   },
   {
    "type": "ISBN_13",
    "identifier": "9780716604891"
   }
  ],
  "readingModes": {
   "text": false,
   "image": false
  },
  "pageCount": 576,
  "printedPageCount": 584,
  "dimensions": {
   "height": "26.00 cm"
  },
  "printType": "BOOK",
  "categories": [
   "Encyclopedias and dictionaries",
   "History",
   "Yearbooks",
   "Reference / Yearbooks & Annuals"
  ],
  "contentVersion": "preview-1.0.0",
  "imageLinks": {
   "smallThumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=5&imgtk=AFLRE736tSIRMcPp77lZYXBvTtzig6KA5oP0RmH9_4--kTDCuQzvlcknopkOZgyLzBFI_hPMd-6MJTcEO-VZZDFzeDCDkjdsiQ&source=gbs_api",
   "thumbnail": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=1&imgtk=AFLRE72NzXnCEhmuPOXXn9VNNBgc-uC37bUnfBkbN25dnVcmdSU8Y3E8rNQNCj7Im_YVWH2RXFeqdQ2tengtOsgCjSJh06Oypg&source=gbs_api",
   "small": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=2&imgtk=AFLRE73COelJADcztpk28bKnJ4GQP7Nn7ScPgUbyk90mt25jpcuoU-cDZD--gj9j3jwutTtkTu6bzVouAdjLxi-sy0AN35bD7A&source=gbs_api",
   "medium": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=3&imgtk=AFLRE73oXHyjFepDB-fitily_UF8UmnKZMrTes6ZVsa576_LNl5wczwkJmW6mv_4RK2_nExpPft8N72BXJ7WUzsGwDLCq-5rEw&source=gbs_api",
   "large": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=4&imgtk=AFLRE71psAjJeg1UFlkqIbh-5IiHVNYPmZW9bb9IQjps23zPD-TlXqQ6RGeVRUMPqYpSVWcYwY8zQnwNITxWLBqp_zgMzpMiYw&source=gbs_api",
   "extraLarge": "http://bks8.books.google.co.uk/books?id=beSP5CCpiGUC&printsec=frontcover&img=1&zoom=6&imgtk=AFLRE70VKrBxxv8Q2Ltr3qhAwh3UMx3d3tv2r2bzwXvlu10_KpyA1TuM0_6RiIEkBe4ENHT21EH_xzPQBe7LWRBgU1IhozIoNQ&source=gbs_api"
  },
  "language": "en",
  "previewLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&hl=&source=gbs_api",
  "infoLink": "http://books.google.co.uk/books?id=beSP5CCpiGUC&hl=&source=gbs_api",
  "canonicalVolumeLink": "http://books.google.co.uk/books/about/The_1989_World_Book_year_book.html?hl=&id=beSP5CCpiGUC"
 },
 "saleInfo": {
  "country": "GB",
  "saleability": "NOT_FOR_SALE",
  "isEbook": false
 },
 "accessInfo": {
  "country": "GB",
  "viewability": "NO_PAGES",
  "embeddable": false,
  "publicDomain": false,
  "textToSpeechPermission": "ALLOWED",
  "epub": {
   "isAvailable": false
  },
  "pdf": {
   "isAvailable": false
  },
  "webReaderLink": "http://books.google.co.uk/books/reader?id=beSP5CCpiGUC&hl=&printsec=frontcover&output=reader&source=gbs_api",
  "accessViewStatus": "NONE",
  "quoteSharingAllowed": false
 }
}

Any suggestions are welcome, If there is a better or more efficient way of retrieving thumbnails/info please let me know as this is a personal development project and I am willing to learn.

I can provide my current code if necessary.

Answer

jonboy picture jonboy · Nov 21, 2014

I decided to go with https://www.googleapis.com/books/v1/volumes?q=isbn:0716604892 as it proved to be more reliable and suitable.