more G-Labs products

Author Topic: jkUtils - OpenWeatherData requires API key  (Read 1696 times)

October 17, 2015, 07:13:07 PM
Read 1696 times

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
It appears that OpenWeatherData has changed their API such that it now requires an API key.  I have not received data in a few days and manually entered the URL into firefox.

Code: [Select]
Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.
I have not checked into obtaining an API key yet, but I assume it's free for private use.

October 18, 2015, 05:43:51 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
The API key is free for personal use.  It appears that it can only be used so many times in a period as I started to receive errors after a bit of testing.  It also appears that the response data may not be the same format as what OpenWeatherMap used to reply with since updating the URL to a valid one including APIkey did not get things functioning again.  If someone that knows more about this code were to take a look, it would probably be an easy fix.  I don't know what the response used to be, so I'm not sure how to fix the code myself.

October 21, 2015, 05:37:19 PM
Reply #2

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I was able to get it working by adding APPID api key to the webserviceurl:

Code: [Select]
  string webserviceurl = "http://api.OpenWeatherMap.org/data/2.5/weather?q="+ location +"&lang=" + language+"&appid=" + apikey;
I didn't request an API key yet, but found working one for testing in the URL for the example here: http://openweathermap.org/current#name

So it seems the JSON response parameters are the same, my widget has updated.

October 21, 2015, 05:56:29 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Strange.  I tried that first and it didn't work.

May 01, 2017, 01:48:14 PM
Reply #4

gbremmer

  • *
  • Information
  • Newbie
  • Posts: 23
I've updated the program with an option to set the API key, see attached file.
Perhaps somebody can upload it to GitHub?

May 30, 2017, 02:58:59 PM
Reply #5

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
I need just this so have created a pull request for the changed module - I have however set the enabled flag back to the existing package state, mainly as it is a pet hate for programs to be enabled by default :)