Weather App has broken - any guidance?

Weather App has broken - any guidance?
0

#1

Hello there,

I finished my weather app a few months back, however I wanted to return to add a new feature. However, since my return, my API call to the OpenWeatherMap seems to be throwing a 404. I can’t seem to find anything on the API that may have changed… Not sure where the problem may lie.

You can view and pull my code down at https://github.com/jamesbarrett95/Weather-Application

Any advice would be greatly appreciated.

Thanks,
James.


#2

I’m not expert, but when I plug your api url (with the key) into my browser:

http://api.openweathermap.org/data/2.5/forecast?id=524901&APPID=d408a4f66848e2c8e5747679380bf72

I get the following response:

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

Are you sure that key is good? Do they expire?


#3

Hi,

Thanks for the reply.

I just tried a new API key and still receiving the error… Very strange. I’m under the assumption that the params are fine as nothing has changed on the API.

Maybe something that the support centre can help with…

Thanks,
James.


#4

I don’t understand because when I do this string from my app with my id:

http://api.openweathermap.org/data/2.5/weather?lat=50.0&lon=50.0&appid=3864f48bfe6a511e20e809ee8857fe16

I get a good response:

{
  "coord": {
    "lon": 50,
    "lat": 50
  },
  "weather": [
    {
      "id": 803,
      "main": "Clouds",
      "description": "broken clouds",
      "icon": "04n"
    }
  ],
  "base": "stations",
  "main": {
    "temp": 294.368,
    "pressure": 1021.32,
    "humidity": 38,
    "temp_min": 294.368,
    "temp_max": 294.368,
    "sea_level": 1022.32,
    "grnd_level": 1021.32
  },
  "wind": {
    "speed": 3.41,
    "deg": 264.5
  },
  "clouds": {
    "all": 64
  },
  "dt": 1498252834,
  "sys": {
    "message": 0.0042,
    "country": "KZ",
    "sunrise": 1498177888,
    "sunset": 1498236798
  },
  "id": 607847,
  "name": "Batys Qazaqstan Oblysy",
  "cod": 200
}

When I sub in your appid:

http://api.openweathermap.org/data/2.5/weather?lat=50.0&lon=50.0&appid=d408a4f66848e2c8e5747679380bf72

I still get a bad response:

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

I think the problem is your appid.