Getting Daily Weather Forecasts from OpenWeatherMap API using Flutter

532 views Asked by At

i have an issue with OpenWeatherMap API for hourly weather forecasts. i retrieved the 5 day/3 hours weather data from this api. But now i want daily weather forecasts. i am using this api but this one gives me this error, i tried many times but it gives me the same error.

{
"cod": 401,
"message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."
}

meanwhile i am using this api for getting daily weather forecasts

https://pro.openweathermap.org/data/2.5/forecast/hourly?lat=21&lon=39&appid=58b73781d0f050d557b4ac143bb61b0c

kindly suggest me the some solution that why i am unable to get the response for daily weather forecasts.

1

There are 1 answers

1
Sam On

The documentation states:

You can get the error 401 in the following cases:

  • You did not specify your API key in API request.
  • Your API key is not activated yet. Within the next couple of hours, it will be activated and ready to use.
  • You are using wrong API key in API request. Please, check your right API key in personal account.
  • You are using a Free subscription and try requesting data available in other subscriptions . For example, 16 days/daily forecast API, any historical weather data, Weather maps 2.0, etc). Please, check your subscription in your personal account

If you subscribe to the openweathermap api, it will provide you with an api key to access the data.