# Travel App Api is correct but App hangs

**URL:** https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100
**Category:** Web API's
**Tags:** beginner
**Created:** [January 2, 2023, 6:46am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100 "2023-01-02T06:46:45Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 6:46am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/1 "2023-01-02T06:46:45Z")

</div>

[https://x.thunkable.com/copy/487ef67fbfc6fcac01f745bff56a36a1](https://x.thunkable.com/copy/487ef67fbfc6fcac01f745bff56a36a1)

Travel Api i m using is verified from Rapid Api(Hotels)…but when i click on search …App just closes.  
kindly help

---

<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: [January 2, 2023, 6:55am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/2 "2023-01-02T06:55:41Z")

</div>

It’s helpful if you can provide the full JSON response you’re getting when you click the Search button. To do that, assign the green `response` block to a Text Input. Either remove all other blocks after that or add a long wait (say, 5 seconds) so that you have time to copy the response before the app crashes.

Paste the full JSON here as text and we can probably help you solve this.

It’s also helpful if you post a link to the documentation for the API you’re using.

---

<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: [January 2, 2023, 7:03am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/3 "2023-01-02T07:03:31Z")

</div>

I do see on Rapid API that the url you’re using is deprecated and should be replaced with “[https://hotels4.p.rapidapi.com/locations/v3/search](https://hotels4.p.rapidapi.com/locations/v3/search)”

---

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 7:07am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/4 "2023-01-02T07:07:49Z")

</div>

Ok i will do that…thanx

---

<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: [January 2, 2023, 7:17am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/5 "2023-01-02T07:17:37Z")

</div>

I noticed several problems with the blocks you’re using:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/2/82a67ce61717362f123e223ccdddd09e51979f73.png)

1. You assigned an empty string (“”) to app variable numberofHotels when you initialized it but then you set it to an empty list. It can’t be a string and a list. You have to choose one type of variable. So I’d remove the empty string from the initialize block. You can initialize it to an empty list but you don’t have to.

2. You’re using a parameter called “name” but in the documentation, that parameter is called “q”.

3. I noticed that the locale for the U.S. is “en-US”. ~~Upper/lower case matters so if it’s supposed to be “en-GB”, you need to change that.~~ **Edit:** “en-gb” works just fine.

4. The response I get from the endpoint test on the Rapid API site has “q” as the property name so if you try to get the property called “name”, it’s going to fail and crash your app.

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

1. I don’t see a list in the response, except in the “sr” property, which would be indicated by square brackets (). Where did you find that? Again, if you can post the full JSON response here, it will be very helpful.

---

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 7:22am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/6 "2023-01-02T07:22:21Z")

</div>

Ok cool…i will change it

---

<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: [January 2, 2023, 7:23am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/7 "2023-01-02T07:23:05Z")

</div>

Here’s a successful way to get at least one property value (“fullName”) from the API:

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

---

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 7:40am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/8 "2023-01-02T07:40:45Z")

</div>

![new](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/8/e850442bb1f0124f9f33277112fb7d0c673d8a8e.png)  
this the response i got

`{"q":"berlin","rid":"097d0acd78d84737aafd0c013e88dcd6","rc":"OK","sr":[{"@type":"gaiaRegionResult","index":"0","gaiaId":"536","type":"CITY","regionNames":{"fullName":"Berlin, Germany","shortName":"Berlin","displayName":"Berlin, Germany","primaryDisplayName":"Berlin","secondaryDisplayName":"Germany","lastSearchName":"Berlin"},"essId":{"sourceName":"GAI","sourceId":"536"},"coordinates":{"lat":"52.51384","long":"13.35008"},"hierarchyInfo":{"country":{"name":"Germany","isoCode2":"DE","isoCode3":"DEU"}}},{"@type":"gaiaRegionResult","index":"1","gaiaId":"183784","type":"CITY","regionNames":{"fullName":"Berlin, Ohio, United States of America","shortName":"Berlin","displayName":"Berlin, Ohio, United States","primaryDisplayName":"Berlin","secondaryDisplayName":"Ohio, United States","lastSearchName":"Berlin"},"essId":{"sourceName":"GAI","sourceId":"183784"},"coordinates":{"lat":"40.561173","long":"-81.794304"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaRegionResult","index":"2","gaiaId":"79155","type":"CITY","regionNames":{"fullName":"Berlin, Maryland, United States of America","shortName":"Berlin","displayName":"Berlin, Maryland, United States","primaryDisplayName":"Berlin","secondaryDisplayName":"Maryland, United States","lastSearchName":"Berlin"},"essId":{"sourceName":"GAI","sourceId":"79155"},"coordinates":{"lat":"38.322709","long":"-75.217933"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaRegionResult","index":"3","gaiaId":"6382","type":"CITY","regionNames":{"fullName":"Berlin, New Hampshire, United States of America","shortName":"Berlin","displayName":"Berlin, New Hampshire, United States","primaryDisplayName":"Berlin","secondaryDisplayName":"New Hampshire, United States","lastSearchName":"Berlin"},"essId":{"sourceName":"GAI","sourceId":"6382"},"coordinates":{"lat":"44.468669","long":"-71.185076"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaRegionResult","index":"4","gaiaId":"601763","type":"CITY","regionNames":{"fullName":"Burlington, Vermont, United States of America","shortName":"Burlington","displayName":"Burlington, Vermont, United States","primaryDisplayName":"Burlington","secondaryDisplayName":"Vermont, United States","lastSearchName":"Burlington"},"essId":{"sourceName":"GAI","sourceId":"601763"},"coordinates":{"lat":"44.476578","long":"-73.21254"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaRegionResult","index":"5","gaiaId":"553248635056399195","type":"POI","regionNames":{"fullName":"Lou Berliner Sports Park, Columbus, Ohio, United States of America","shortName":"Lou Berliner Sports Park","displayName":"Lou Berliner Sports Park, Columbus, Ohio, United States","primaryDisplayName":"Lou Berliner Sports Park","secondaryDisplayName":"Columbus, Ohio, United States","lastSearchName":"Lou Berliner Sports Park"},"essId":{"sourceName":"GAI","sourceId":"553248635056399195"},"coordinates":{"lat":"39.93197987610981","long":"-83.00661943987757"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaRegionResult","index":"6","gaiaId":"7146","type":"CITY","regionNames":{"fullName":"Burlingame, California, United States of America","shortName":"Burlingame","displayName":"Burlingame, California, United States","primaryDisplayName":"Burlingame","secondaryDisplayName":"California, United States","lastSearchName":"Burlingame"},"essId":{"sourceName":"GAI","sourceId":"7146"},"coordinates":{"lat":"37.577869","long":"-122.348091"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}},{"@type":"gaiaHotelResult","index":"7","hotelId":"57232524","type":"HOTEL","regionNames":{"fullName":"Steigenberger Airport Hotel Berlin, Schoenefeld, Brandenburg Region, Germany","shortName":"Steigenberger Airport Hotel Berlin","displayName":"Steigenberger Airport Hotel Berlin, Schoenefeld, Brandenburg Region, Germany","primaryDisplayName":"Steigenberger Airport Hotel Berlin","secondaryDisplayName":"Schoenefeld, Brandenburg Region, Germany","lastSearchName":"Steigenberger Airport Hotel Berlin"},"essId":{"sourceName":"LCM","sourceId":"57232524"},"coordinates":{"lat":"52.364089","long":"13.512011"},"hierarchyInfo":{"country":{"isoCode3":"DEU"}},"cityId":"6051563","hotelAddress":{"street":"Willy-Brandt-Platz 3","city":"Schoenefeld","province":""}},{"@type":"gaiaRegionResult","index":"8","gaiaId":"6275075","type":"POI","regionNames":{"fullName":"Kurfürstendamm, Berlin, Germany","shortName":"Kurfürstendamm","displayName":"Kurfürstendamm, Berlin, Germany","primaryDisplayName":"Kurfürstendamm","secondaryDisplayName":"Berlin, Germany","lastSearchName":"Kurfürstendamm"},"essId":{"sourceName":"GAI","sourceId":"6275075"},"coordinates":{"lat":"52.50170664214879","long":"13.321330888105717"},"hierarchyInfo":{"country":{"name":"Germany","isoCode2":"DE","isoCode3":"DEU"}}},{"@type":"gaiaRegionResult","index":"9","gaiaId":"6287096","type":"NEIGHBORHOOD","regionNames":{"fullName":"Ocean Pines, Berlin, Maryland, United States of America","shortName":"Ocean Pines","displayName":"Ocean Pines, Berlin, Maryland, United States","primaryDisplayName":"Ocean Pines","secondaryDisplayName":"Berlin, Maryland, United States","lastSearchName":"Ocean Pines"},"essId":{"sourceName":"GAI","sourceId":"6287096"},"coordinates":{"lat":"38.395393","long":"-75.155739"},"hierarchyInfo":{"country":{"name":"United States","isoCode2":"US","isoCode3":"USA"}}}]}`

---

<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: [January 2, 2023, 7:51am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/9 "2023-01-02T07:51:06Z")

</div>

I re-formatted the JSON you posted by using the Preformatted text button (\</\>) in the forums toolbar. That removes the smart quotes. Now you can copy that entire wall of text and paste it into [https://codebeautify.org/jsonviewer](https://codebeautify.org/jsonviewer) to view the JSON tree. If you click on a property name on the right side of the window, it will show the path to that property at the top. Like this:

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

If you need to know more about how to parse JSON, you can watch my tutorial video here: [API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575)

---

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 10:14am UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/10 "2023-01-02T10:14:58Z")

</div>

Ok thanx…i will watch ur video

---

<div class="post-metadata">

### Author: ![krishanveer.gangwars](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krishanveer.gangwars](https://community.thunkable.com/u/krishanveer.gangwars)
#### Post date: [January 2, 2023, 12:55pm UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/11 "2023-01-02T12:55:32Z")

</div>

(its a different question)hey i got this array of 5 elements instead of object…i want the city\_ufi

 ![new1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/6/e62f9f58021e27ae575e118a62167636faaf055c.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: [January 2, 2023, 5:22pm UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/12 "2023-01-02T17:22:34Z")

</div>

I explain that in the video around 21:54: [API JSON Tutorial - YouTube](https://www.youtube.com/watch?v=f89HhRDP-AE&t=1314s)

If you have trouble, post a screenshot of your blocks.

---

<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:37pm UTC](https://community.thunkable.com/t/travel-app-api-is-correct-but-app-hangs/2201100/13 "2024-11-08T13:37:10Z")

</div>


