Google Books API

Hello,

I was wondering if anyone has any suggestions on how to use the Google Books API (found here).

I have tried using this but I get a white screen.

I want the user to scan a ISBN bar code using the bar code scanner, the API would then tell me what books have been scanned.

I would appreciate any suggestions on how to do this.

Best,
Ian

Can you provide an example of a URL you’ve used to get a JSON response from the Google Books API? A white screen usually indicates that you’re getting an error from the API server. But if you’re starting with a valid JSON response, we can probably help you parse the data you need. If you’re starting with an invalid JSON response (a 404 error, etc.) then that needs to get fixed before Thunkable is even a consideration.

Hello,

The URL I am using looks something like this, but varies by user: https://www.googleapis.com/books/v1/volumes?q=isbn:9781524717582&key=myAPIkey

In the app if I set the API to search for a specific book, it returns the correct title. I assume it has something to do with searching by ISBN.

Best,
Ian

The response I get from that URL using my API key is:

{
“kind”: “books#volumes”,
“totalItems”: 0
}

And I see that that is a valid ISBN number.

That tells me the problem is possibly that you’re not checking for a return value of totalItems=0.

Can you post a screenshot of the API call blocks you’re using?

Here are the blocks that I am using.

You’re getting a white screen because you’re trying to retrieve a property that doesn’t exist (“item”). So you need an if/then to see if that property exists.

But the bigger issue — as you mentioned — is that the ISBN call isn’t returning the right information. That was the first time I’ve used Google Books API so I don’t know the answer to that.

I would focus on getting the url call to work in a browser before you do anything else in Thunkable.

1 Like

Ok, I will work on this, thanks for your help!

You’re welcome. It’s weird because this works:

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

But if I substitute your ISBN, it returns 0 items.

Huh, apparently google does not like my book.

No, it doesn’t. It works with a few other ISBNs I tried. Did you write that book?

No. It was just a random book I found sitting around my house, its called Welcome to Wonderland, Sandapalooza Shake-Up.

1 Like

I tested this using a different book with the same code on Thunkable and it worked. I think I will defiantly need to add code that checks if it returned a book before parsing before I update my currently published app to have this feature.

1 Like