Weather forecast

Hello
I watched the videos https://www.youtube.com/watch?v=V-OO0wEYcrs
the APIKEy to take the temperature from the site https://home.openweathermap.org/api_keys
I would like to know if it is possible to take rain or sun or cloud data

I’ve used their weather icons… is that what you mean?

I intend to take the forecasts, even the icons, and if possible have the forecasts for a given day

I haven’t worked with forecasts. I’ve only gotten current conditions.

But this topic is all about getting the weather icon:

http://api.openweathermap.org/data/2.5/weather?q=Londra&units=metric&APPID=6921a88aa644707f21e8a964942214ae

I would like to retrieve the data in bold

{“coord”:{“lon”:-0.0918,“lat”:51.5128},“weather”:[{“id”:500,“main”:“Rain”,“description”:“light rain”,“icon”:“10n”}],“base”:“stations”,“main”:{“temp”:5.27,“feels_like”:4.47,“temp_min”:3.95,“temp_max”:6.25,“pressure”:998,“humidity”:79},“visibility”:10000,“wind”:{“speed”:1.34,“deg”:274,“gust”:5.36},“rain”:{“1h”:0.18},“clouds”:{“all”:40},“dt”:1638654025,“sys”:{“type”:2,“id”:2019646,“country”:“GB”,“sunrise”:1638604085,“sunset”:1638633211},“timezone”:0,“id”:2643741,“name”:“City of London”,“cod”:200}

if I recover the temperature with these blocks, because I cannot recover the other data as well

I’m reposting your JSON text with smart quotes removed since the forum software seems to mess that up:

{"coord":{"lon":-0.0918,"lat":51.5128},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":5.27,"feels_like":4.47,"temp_min":3.95,"temp_max":6.25,"pressure":998,"humidity":79},"visibility":10000,"wind":{"speed":1.34,"deg":274,"gust":5.36},"rain":{"1h":0.18},"clouds":{"all":40},"dt":1638654025,"sys":{"type":2,"id":2019646,"country":"GB","sunrise":1638604085,"sunset":1638633211},"timezone":0,"id":2643741,"name":"City of London","cod":200}

One way to avoid that is to add three tick marks (```) before and after the JSON text. Or select your text and click the Preformatted text button in the post toolbar:

image

When I put that reformatted text into Best JSON Viewer and JSON Beautifier Online, I get this:

You can see that when I clicked on “description” on that site, it provides the path to that property at the top. So it’s (object)–>weather–>[first list item]–>description.

Try this property in the get property of object block: “weather[1].description” or “weather[1].icon”. You can use multiple get property of object blocks as in your screenshot but you don’t have to. My method is a shortcut where you add all properties and list indexes in a single text string.

Here’s a demo project (see the screen with your username in the title):

https://x.thunkable.com/copy/bc9585eeb54499f5352488634b3b8a7c

Note: I removed your APP ID from the Web_API1’s URL block. It’s up to you but you may want to remove it from your post above since anyone can then use your APP ID/key.

1 Like

Thank you so much

Hello
I tried to insert the following link for the forecast 3 days from today, but it gives me an API error, are there any restrictions for use?

https://openweathermap.org/forecast16#limit

Example link from the site by inserting my ApiKey

[http://api.openweathermap.org/data/2.5/forecast/daily?q=London&cnt=3&appid={API key}](http://api.openweathermap.org/data/2.5/forecast/daily?q=London&cnt=3&appid=[{API key}](Members))

Result

{“cod”:401, “message”: “Invalid API key. Please see Frequently Asked Questions - OpenWeatherMap for more info.”}

can you clarify the subject?

Have you paid for a subscription? The free version of OpenWeatherMap does not allow you to get daily forecast data for 16 days which I think is what you’re trying. Instead, use the free 5 day forecast:

https://openweathermap.org/forecast5

So an example that works for me is:

https://api.openweathermap.org/data/2.5/forecast?q=London&cnt=3&appid={API%20key}

1 Like