# Search for API data using a part of a parameter

**URL:** https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101
**Category:** Questions about Thunkable X
**Tags:** i\_need\_your\_help, webapi
**Created:** [March 15, 2021, 2:26am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101 "2021-03-15T02:26:53Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 2:26am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/1 "2021-03-15T02:26:53Z")

</div>

Hey guys, I’m making an app where I pull location data based on the Zip code given. Is there a way to make thunkable give me data for the first 3 digits of the zip code matching locations instead of having a complete zip code? Im just trying to make it pull more general data. Need help ASAP. Thanks!

---

<div class="post-metadata">

### Author: ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)
#### Post date: [March 15, 2021, 2:57am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/2 "2021-03-15T02:57:21Z")

</div>

Welcome to the community @jtianga23lf!

If I understood correctly what your trying to do is something like this:

Zip code: 123456 → get first three digits: 123

If so, try this block:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/4/1428c7c1f3eaa42365513ca0883a2e6366493a8f.png)

Just set the zip code to the abc part and get the substring from letter #1 to letter #3

Hope this helps!

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 3:17am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/3 "2021-03-15T03:17:10Z")

</div>

If your API allows it, then sure.

Which API are you using?

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 3:38am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/4 "2021-03-15T03:38:39Z")

</div>

Looks good, I’ll let you know. Thanks so much!

---

<div class="post-metadata">

### Author: ![glenncronings3](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/glenncronings3/32/99142_2.png) [@glenncronings3](https://community.thunkable.com/u/glenncronings3)
#### Post date: [March 15, 2021, 4:03am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/5 "2021-03-15T04:03:26Z")

</div>

can you plz help me in my q

---

<div class="post-metadata">

### Author: ![glenncronings3](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/glenncronings3/32/99142_2.png) [@glenncronings3](https://community.thunkable.com/u/glenncronings3)
#### Post date: [March 15, 2021, 4:03am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/6 "2021-03-15T04:03:58Z")

</div>

can you plz help me in my q.

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 4:54am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/7 "2021-03-15T04:54:53Z")

</div>

Where would I insert this line in my code? Sorry, I’m very new.

 ![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/7/379827e19b9b8c91ecc993cacebe7f34dcaae7a9.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 5:07am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/8 "2021-03-15T05:07:47Z")

</div>

I don’t know what you’re referring to. If there’s another topic you want help with, just post an update with more details, etc. You can also refer to another topic by clicking the link icon below the post and then copying and pasting it into a new post.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 5:11am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/9 "2021-03-15T05:11:51Z")

</div>

Any chance you can post the text of the full JSON response you’re getting? If you put the URL in a browser, you can then see that response.

It looks like you’re off to a good start. I discuss that step and what’s helpful to post when troubleshooting APIs in this tutorial post: [API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575).

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 5:16am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/10 "2021-03-15T05:16:57Z")

</div>

Its a very long reponse. I’ll just give you the link.

[https://covid-19-testing.github.io/locations/new-york/complete.json](https://covid-19-testing.github.io/locations/new-york/complete.json)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 5:32am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/11 "2021-03-15T05:32:55Z")

</div>

That’s really helpful! If you copy and paste that full response into a JSON formatter such as [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer), you can view the structure of the JSON. On that site, click Tree Viewer and then on the right side, you can either browse or search for a property name.

If you’re trying to get the zip code, I believe you’ll want to use the postal code. If you click on that property, as in the screenshot below, you can start to construct the path to the property (listed at the top of the screenshot). Note that any property with square brackets [] indicates a JSON array and wil need to be accessed using list blocks in Thunkable. I cover all of that in my tutorial video, FYI.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/a/aa0b55a7e9b9c19ac14c01f85ef76efadd70a45d.png)

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 5:50am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/12 "2021-03-15T05:50:23Z")

</div>

I was able to get the location data when putting in a full zip code

 ![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/1/719f5556f2f6d6c8ed60fbf63d7fec637e758066.png) . How can i integrate the get substring line into what I have to use a partial postal code? The block I plan to use is above my to getDataList chain.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 6:50am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/13 "2021-03-15T06:50:24Z")

</div>

You can check to see if the variable “zip” is equal to the substring from letter #1 to #3 of the variable “Location Zip”. So you’d put “app variable Location Zip” in the “abc” field and then change the “2” to “3” for the letter #.

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 7:01am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/15 "2021-03-15T07:01:42Z")

</div>

Where do i put this new string of code?

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [March 15, 2021, 7:37am UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/16 "2021-03-15T07:37:53Z")

</div>

Replace this equality:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/c/5ce4ed4d0d2dc5f73f9b138290caa1971bf83b0f.png)

---

<div class="post-metadata">

### Author: ![jtianga23lf](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jtianga23lf](https://community.thunkable.com/u/jtianga23lf)
#### Post date: [March 15, 2021, 2:24pm UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/17 "2021-03-15T14:24:47Z")

</div>

Awesome, it works! Thanks so much!

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:28pm UTC](https://community.thunkable.com/t/search-for-api-data-using-a-part-of-a-parameter/1167101/18 "2024-11-08T13:28:51Z")

</div>


