Book information by ISBN number using ASP.NET from Google API

Dear Friends,
In last 2 posts we have talked about ISBNDB.com(https://indiandotnet.wordpress.com/2012/10/24/book-detail-by-isbn-number-using-asp-net/)

& Wordcat.org (https://indiandotnet.wordpress.com/2012/10/24/book-details-by-isbn-using-asp-net-from-worldcat-org/).
Now here I am talking about one more great service provider which Google. We can use Google API to fetch book detail using ISBN number.
To use Google API you have to create account and register for API.

In this example I am not using API, I am just trying to access the detail directly using URL.
Below URL is used for providing the detail of the book using ISBN

https://www.googleapis.com/books/v1/volumes?q=0123344+ISBN

So let us start to fetch detail

As the response of this URL in JSON so for change I have used JSON parser here I have used JSON.NET which you can download from codeplex site.

The design of the page is same one textbox for ISBN and one search button. On search button click I wrote following code.

‘Step 1:- google API url responsible for returning the book detail in JASON format
Private Const GOOGLEAPIURL As String = “https://www.googleapis.com/books/v1/volumes?q=”

If Me.txtISBN.Text <> String.Empty Then
Dim requestURL As String

‘Step 2:- Reformed the URL to target particular ISBN number
requestURL = GOOGLEAPIURL + Me.txtISBN.Text.Trim() + “+isbn”

‘Step 3: created Http webrequest for URL
Dim wr As HttpWebRequest = HttpWebRequest.Create(requestURL)
‘Step4 : get the response of web request in http web response object
Dim resp As HttpWebResponse = wr.GetResponse()

‘Step 5: passes the response stream in stream reader
Dim sreader As New StreamReader(resp.GetResponseStream())
‘Step 6: parsing the reader(which is in Jason format) using JASON.NET

Dim rss = JObject.Parse(sreader.ReadToEnd())

‘Step 7: if object find the fetch the detail

If rss Is Nothing = False AndAlso rss.Count > 0 Then
Me.lblBookName.Text = rss.Item(“items”)(0).Item(“volumeInfo”).Item(“title”).ToString()
Me.lblAuthor.Text = rss.Item(“items”)(0).Item(“volumeInfo”).Item(“authors”).ToString().Replace(“[“, “”).Replace(“]”, “”).ToString()
Me.lblPublisher.Text = rss.Item(“items”)(0).Item(“volumeInfo”).Item(“publisher”).ToString()
Else
Me.lblMessage.Text = “Sorry ISBN Number not found, Please try different number.”
End If
Else
Me.lblMessage.Text = “Please enter the ISBN number”
End If

So in this way we have accessed book information from Google API URL without using API key.
Thanks & best regards,
Rajat Jaiswal

Advertisements

2 thoughts on “Book information by ISBN number using ASP.NET from Google API

  1. thank you so much for the article it’s really very informative but is there anyway i can send the Book Title and author and return the ISBN ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s