KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to figure out how to search for a book by ISBN using the Google Books API. I need to write a program that searches for an ISBN then prints out the title, author, and edition. I tried using List volumesList = books.volumes.list(""); but that did not allow me to search by ISBN and I did not see a way to get the information I needed(when an ISBN was placed in it had no results) . What I have right now is: JsonFactory jsonFactory = new JacksonFactory(); final Books books = new Books(new NetHttpTransport(), jsonFactory); List volumesList = books.volumes.list("9780262140874"); volumesList.setMaxResults((long) 2); volumesList.setFilter("ebooks"); try { Volumes volumes = volumesList.execute(); for (Volume volume : volumes.getItems()) { VolumeVolumeInfo volumeInfomation = volume.getVolumeInfo(); System.out.println("Title: " + volumeInfomation.getTitle()); System.out.println("Id: " + volume.getId()); System.out.println("Authors: " + volumeInfomation.getAuthors()); System.out.println("date published: " + volumeInfomation.getPublishedDate()); System.out.println(); } } catch (Exception ex) { // TODO Auto-generated catch block System.out.println("didnt wrork "+ex.toString()); } If anyone has any suggestions about how to make this more efficient let me know. New Code: String titleBook=""; //////////////////////////////////////////////// try { BooksService booksService = new BooksService("UAH"); String isbn = "9780262140874"; URL url = new URL("http://www.google.com/books/feeds/volumes/?q=ISBN%3C" + isbn + "%3E"); VolumeQuery volumeQuery = new VolumeQuery(url); VolumeFeed volumeFeed = booksService.query(volumeQuery, VolumeFeed.class); VolumeEntry bo
Tags (comma-separated)
Save Edits
Cancel