[SOLVED]Trouble receiving data from web api

Hello everyone,

I am having trouble receiving data from an api called weatherbit
it requires an api key which i have given, I want to just display the weather from the response.
It also requires:- (which are given)

  • Latitude & Longitude (which are given through map component)

This what I have tried so far: -

1 Like

You need to fist check the green error block to see that the API has been executed successfully before attempting to read the response block.

1 Like

it gives null

When using an API with Thunkable, the first step should be to make sure you can get a valid JSON response in a browser without using Thunkable. What happens if you paste the whole url into a browser? Does that work? If so, post that response here as text and format it using the “Preformatted text” button in the toolbar ( </> ).

Also, I don’t think there is a “temp” property at the top level of the JSON. So once we have your JSON response, we can help you figure out how to access that property. You may find my tutorial helpful: API JSON Tutorial (Video).

Edit: there are many “temp” properties but the first one is here:

You can see on Best JSON Viewer and JSON Beautifier Online that the path to that property shown at the top is “data[1].temp” whereas you’re trying to access it as just “temp”.

4 Likes

I got my mistake by your tutorial, Thanks @tatiang @muneer for replying! :grinning:

2 Likes