# How to use JSON to call API that searches ISBNs

**URL:** <https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421>\
**Category:** Ask for Help\
**Tags:** api, call-api, json\
**Created:** [October 28, 2024, 5:02pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421 "2024-10-28T17:02:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mustangTC](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mustangtc/32/91321_2.png) [@mustangTC](https://community.glideapps.com/u/mustangTC)\
**Post date:** [October 28, 2024, 5:02pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/1 "2024-10-28T17:02:01Z")

</div>

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!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/1/814fa434746a1f618bea707d1a0eb85276d86c4a.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 29, 2024, 1:01am UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/2 "2024-10-29T01:01:17Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/7/07ac18bd58d1d7a3499772861e5bf98090d00e76.png)

Is your flow looking like this?

> [@mustangTC](#):
>
> 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!

“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?

---

<div class="post-metadata">

**Author:** ![mustangTC](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mustangtc/32/91321_2.png) [@mustangTC](https://community.glideapps.com/u/mustangTC)\
**Post date:** [October 29, 2024, 12:41pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/3 "2024-10-29T12:41:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mustangTC](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mustangtc/32/91321_2.png) [@mustangTC](https://community.glideapps.com/u/mustangTC)\
**Post date:** [October 29, 2024, 3:52pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/4 "2024-10-29T15:52:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [October 29, 2024, 5:55pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/5 "2024-10-29T17:55:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mustangTC](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mustangtc/32/91321_2.png) [@mustangTC](https://community.glideapps.com/u/mustangTC)\
**Post date:** [October 29, 2024, 8:53pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/6 "2024-10-29T20:53:38Z")

</div>

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… 😮‍💨

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [October 29, 2024, 11:21pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/7 "2024-10-29T23:21:00Z")

</div>

You can try it directly in Glide:

 ![Screenshot 2024-10-30 at 06.36.06](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/e/fe13dd129210d1ba360f3c1de4ac888dfbe3fae3.jpeg)

 ![Screenshot 2024-10-30 at 06.44.04](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/a/3af7e4e372b65226e3596cded01b775498b8772c.png)

```auto
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.

---

<div class="post-metadata">

**Author:** ![mustangTC](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mustangtc/32/91321_2.png) [@mustangTC](https://community.glideapps.com/u/mustangTC)\
**Post date:** [October 30, 2024, 1:52pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/8 "2024-10-30T13:52:52Z")

</div>

> [@Himaladin](#):
>
> `isbn:${p1}`

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!

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [October 30, 2024, 2:01pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/9 "2024-10-30T14:01:56Z")

</div>

You’re welcome

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [November 6, 2024, 2:02pm UTC](https://community.glideapps.com/t/how-to-use-json-to-call-api-that-searches-isbns/77421/10 "2024-11-06T14:02:54Z")

</div>

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