[Solved] Web-API Returning unknown error

Hi everyone, I am getting this error on using a web-API component in my app.
@domhnallohanlon Could you help?
Could someone help me?


I am using Thunkable Live to test my app.

You’ll need to post a screenshot of the blocks you’re using to get data from the API. Make sure the full url is included (remove your API key first).

My Blocks (Removed the API Key)


I followed this tutorial: How to use the Thunkable Web API: Weather App - Part 1 - YouTube

Your blocks look correct to me. If I use your url and substitute “oakland” for the location variable and enter that all in a browser with my API key, I get a valid JSON response:

{"coord":{"lon":-83.3999,"lat":42.6667},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"base":"stations","main":{"temp":-8.45,"feels_like":-13.33,"temp_min":-9,"temp_max":-7.78,"pressure":1027,"humidity":86},"visibility":10000,"wind":{"speed":2.57,"deg":40},"clouds":{"all":75},"dt":1613186721,"sys":{"type":1,"id":5424,"country":"US","sunrise":1613133269,"sunset":1613170882},"timezone":-18000,"id":5004223,"name":"Oakland","cod":200}

Copying and pasting that into a JSON formatter, I then get:

Screen Shot 2021-02-12 at 7.32.58 PM

Which shows me that the correct properties are “main” and then “temp”.

Because it’s not working for you, my guess would be that there’s a problem with your API key or some other reason the server is not returning the response you’re expecting.

Are you able to paste the full url into a browser window and get valid JSON as a response? That should be your first step before doing anything in Thunkable. For example, if you were to browse to https://api.openweathermap.org/data/2.5/weather?q=oakland&units=metric&APPID=[enter your API key here], do you see a JSON response?

If you set a label to the green error block, what is the value of that block when you preview the app? I always check for that and also check to make sure that the value of the green status block is “200”.

1 Like

I am able to get the response in my browser (STATUS: 200)

Yes

My label shows
image

It works now! Thanks for the help!

1 Like

Glad to hear it! Did you have to change something?

Nope. It started working on its own