# Fetch from api with parameters from collection

**URL:** <https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312>\
**Category:** Ask for Help\
**Created:** [January 31, 2023, 12:17pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312 "2023-01-31T12:17:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/boris/32/53638_2.png) [@Boris](https://community.glideapps.com/u/Boris)\
**Post date:** [January 31, 2023, 12:17pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/1 "2023-01-31T12:17:37Z")

</div>

I was trying to replicate the example provided in [Fetch Data from API and display array result in Collection - #4 by Darren\_Murphy](https://community.glideapps.com/t/fetch-data-from-api-and-display-array-result-in-collection/43398/4) but hit a snag.

The API I want to use uses query parameters (or a request body) to get the data it needs.

How can I pass data from a row to the API?

For example

`[My-Api: The Ultimate SMTP Relay Service](https://my-api.com/get-data/$%7Bcost-from-glide-collection%7D)

BTW data is not loaded inside the tooltip for Fetch JSON  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/f/6f384c50f58d9c2a08124367043537f6daebd585.png)

---

<div class="post-metadata">

**Author:** ![Boris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/boris/32/53638_2.png) [@Boris](https://community.glideapps.com/u/Boris)\
**Post date:** [January 31, 2023, 12:20pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/3 "2023-01-31T12:20:08Z")

</div>

Also where can I find docs on how this column functions?

I can’t seem to find any

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

---

<div class="post-metadata">

**Author:** ![Boris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/boris/32/53638_2.png) [@Boris](https://community.glideapps.com/u/Boris)\
**Post date:** [January 31, 2023, 12:21pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/4 "2023-01-31T12:21:08Z")

</div>

Is there another column I can use to fetch data from an API? Maybe the JavaScript option (which also doesn’t seem to be documented btw)?  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/e/ae6795344f3c1ee33ead56a08fe62b8dfda9f4ba.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:** [January 31, 2023, 2:01pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/5 "2023-01-31T14:01:19Z")

</div>

> [@Boris](#):
>
> How can I pass data from a row to the API?

At it’s most basic, you can construct a url using a template column, but sometimes, special characters can get in the way. In that case, a Construct URL column will properly handle urlencoding and query parameters. The Encode Text column will handle url encoding and base64 encoding if you need it for other uses.

> [@Boris](#):
>
> Also where can I find docs on how this column functions?

[https://www.glideapps.com/docs/reference/computed-columns/plugins](https://www.glideapps.com/docs/reference/computed-columns/plugins)

> **[Plugins | Glide](https://www.glideapps.com/plugins)**
>
> Extend your apps with experimental features.

> **[Fetch JSON column | Glide](https://www.glideapps.com/plugins/fetch)**
>
> Fetch and optionally transform JSON

> [@Boris](#):
>
> Is there another column I can use to fetch data from an API? Maybe the JavaScript option (which also doesn’t seem to be documented btw)?

-I would start with the Fetch column and maybe the Transform JSON column if you need to pull values out of the JSON.  
-You can use the javascript column to write javascript. Pass in parameters, have it do stuff, and return a value. Not much to explain there. As long as you know code, you can probably find a use for it.  
-You could also use the Experimental code column, but you need to host your code on something like Replt or GitHub. Most of the time you can get away with using the javascript column instead. For more info on Experimental Code column, you can do a forum search for ‘experimental code’ or ‘hell yes’.

---

<div class="post-metadata">

**Author:** ![Boris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/boris/32/53638_2.png) [@Boris](https://community.glideapps.com/u/Boris)\
**Post date:** [January 31, 2023, 4:53pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/6 "2023-01-31T16:53:29Z")

</div>

I ended up using Construct URL to build the URL as a new column and then created a second column with Fetch JSON and used the constructed URL as the endpoint.

Thanks for the help @Jeff_Hager !

---

<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:** [February 1, 2023, 4:53pm UTC](https://community.glideapps.com/t/fetch-from-api-with-parameters-from-collection/57312/7 "2023-02-01T16:53:34Z")

</div>

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