# GET API request to display on the glide table

**URL:** <https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871>\
**Category:** Ask for Help\
**Tags:** api\
**Created:** [November 13, 2024, 9:15am UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871 "2024-11-13T09:15:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![brightstar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/brightstar/32/77515_2.png) [@brightstar](https://community.glideapps.com/u/brightstar)\
**Post date:** [November 13, 2024, 9:15am UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/1 "2024-11-13T09:15:55Z")

</div>

I’m gonna get the some date(correctly user location)  
so, I have to send the GET request to the following URL  
[https://nominatim.openstreetmap.org/reverse?format=json&lat=51.165691&lon=10.451526&zoom=18&addressdetails=1](https://nominatim.openstreetmap.org/reverse?format=json&lat=51.165691&lon=10.451526&zoom=18&addressdetails=1)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/6/a6c13387d604e9a24b7973c7472ea11029e1e69a.png)

so, How to fix the this problem?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 13, 2024, 9:21am UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/2 "2024-11-13T09:21:23Z")

</div>

What type of column is `fetchedLocation`?  
Can you show how that is configured?

---

<div class="post-metadata">

**Author:** ![brightstar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/brightstar/32/77515_2.png) [@brightstar](https://community.glideapps.com/u/brightstar)\
**Post date:** [November 13, 2024, 12:32pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/3 "2024-11-13T12:32:18Z")

</div>

Thank you for your reply…  
I don’t know much about it. That’s my problem to solve.  
could you please teach me how to fix this?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 13, 2024, 12:51pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/4 "2024-11-13T12:51:00Z")

</div>

Well for starters:

> [@Darren\_Murphy](#):
>
> What type of column is `fetchedLocation`?  
> Can you show how that is configured?

---

<div class="post-metadata">

**Author:** ![brightstar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/brightstar/32/77515_2.png) [@brightstar](https://community.glideapps.com/u/brightstar)\
**Post date:** [November 13, 2024, 12:54pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/5 "2024-11-13T12:54:07Z")

</div>

I think it’s custom code

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/7/17b96f118fb13344c33ced3c26983c2c2519bc13.png)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 13, 2024, 2:13pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/6 "2024-11-13T14:13:54Z")

</div>

OK, so you don’t have any javascript code yet.

Since your url does not require an API key, you can safely run this in javascript. If any private keys are involved, then I do not recommend this method because anybody could steal your key and use it for themselves.

Also, the javascript method does not provide suitable caching, so every user device will run this code for every row every time that app is opened. This could get a user rate limited if OSM has any restrictions in place.

The best way to run API calls like this is to use the CallAPI function in Glide because it runs server side and caches data, so you can safely use API keys and reduce any chances of being rate limited.

> **[Call API | Glide Docs](https://www.glideapps.com/docs/automation/integrations/call-api)**
>
> Send and receive data from API endpoints.

You being warned of the consequences of using a javascript column. With that said, here is javascript code that will do what you want. The URL should be passed as the p1 parameter.

```auto
async function getFormattedAddress(url) {
    try {
        const response = await fetch(url);
        const data = await response.json();

        if (!data.address) {
            throw new Error("Address data not found");
        }

        const address = data.address;
        const formattedAddress = `${address.road}
${address.city_district || ''}
${address.city}, ${address.county}
${address.state}, ${address.postcode}
${address.country}`;

        // Remove extra spaces or blank lines
        return formattedAddress.trim(); 
    } catch (error) {
        console.error("Error fetching or formatting address:", error);
        return null;
    }
}

if (p1) {
  return await getFormattedAddress(p1);
} else {
  return '';
}

```

---

<div class="post-metadata">

**Author:** ![brightstar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/brightstar/32/77515_2.png) [@brightstar](https://community.glideapps.com/u/brightstar)\
**Post date:** [November 13, 2024, 2:33pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/7 "2024-11-13T14:33:34Z")

</div>

Thank you for your help!

---

<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 20, 2024, 2:34pm UTC](https://community.glideapps.com/t/get-api-request-to-display-on-the-glide-table/77871/8 "2024-11-20T14:34:22Z")

</div>

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