How to use JSON to call API that searches ISBNs

Hello everyone!

I work for a Texas school district, and I have been challenged by the teachers to see if I can create a glide app that replaces a library cataloguing app they used that is no longer working. They are required to have a detailed list of all library books they have available to their students, so this app is fairly important for them.

The idea is that they have a screen in the app where there list of books is located and they have an ‘Add’ feature. The screen to add a book will have an option to input the ISBN which they can manually type in or use a scanner tool they have. After input, I want them to hit a Search button that finds the book title and author from a 3rd party database which I have an API key for. The returned title and author fill into the text fields for each of them (see attached screenshot), then they can complete the remaining fields manually and add it to their list.

My problem is that I have no clue how to implement that API to do what I need it to do… I’m assuming it will be some sort of JSON feature to use the API, but I’m clueless on how to do that in Glide so any help is appreciated! I’m also open to other suggestions to accomplish what I need!

Is your flow looking like this?

“JSON” is a format of data, not a way to use the API. For that, you want to use API Calls. Do you have access to a plan that can use Call API?

1 Like

That is exactly how the flow should work.
I do have a plan with Call API.

I found a workaround. I have the add screen send the ISBN to a google sheet where I wrote an Apps Script with a trigger to call the API whenever a new ISBN lands and then populate the title and author before syncing back to Glide.

Are you using the Google Books API with the following URL:
https://www.googleapis.com/books/v1/volumes?q=isbn:<ISBN> ?

I tried using my Google Books API, but due to what I believe are limitations with Apps Script, the API call would fail because my location couldn’t be verified. The API Key should be the verification tool, and the API works when I manually input the ISBN and key into the URL, but not through Apps Script.

I ended up using the Open Library generic API call which ended up working well with the Apps Script. Although not my first choice… :face_exhaling:

You can try it directly in Glide:

const response = await fetch(`https://www.googleapis.com/books/v1/volumes?q=isbn:${p1}`);
const data = await response.json();

if (data.items && data.items.length > 0) { 
  return JSON.stringify(data); 
} else { 
  return 'Book not found';
}

This script checks if a book with the provided ISBN is found, returning the full JSON data if available, or the message “Book not found” if it isn’t.

2 Likes

Thank you for posting the screenshots! I have been hesitant on using JSON and didn’t realize there was a javascript option for me. I was able to copy your method and tweak it to my needs and it works perfectly! Thank you so much!

1 Like

You’re welcome

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.