If you are reading this, you are probably trying to figure out how to use your api key from openweathermap.org. If you are reading this and don’t know what that is, don’t feel bad. I didn’t either until I started my Android Developer Course. In a nutshell, when your phone app tells you the weather, it gets it from a server somewhere in a special format, called an API, which returns a JSON object. At least, that’s how I understand it.

The problem is, that server will not just tell anyone the data. All of these servers want you to have a key. Most sites offer some sort of free plan for a very limited number of calls, particularly for developers or for personal use. This requires an account. So I got one at openweathermap, and then was given a key.

One of the principle things you need to get the api data from a provider is an api key. This is where I was having big trouble. After registering and getting the key, I then went to the guide on how to use it. It is located here if you are interested, but it didn’t work.


In the guide it told me to use this call method:


Except with my key after APPID=, instead of the 111111111’s. The problem was, it would return this error when I made the call:

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

or sometimes this one:

“This site can’t be reached

api.openweathermap.org refused to connect.”

I was getting a little bit frustrated. I reread the documentation, and I still got bad results. I waited until the next day to make sure my calls per day were reset. Still no luck. I googled, I searched, and eventually, I got to this thread:


Where I learned two really important things that made it all work:

#1. Don’t use https:// in the call, use http:// instead.

#2. Instead of APPID in the call, use appid (lowercase) in the call to get the results.

Once I did these two things, it immediately started working for me. So if you are having trouble, you should give that a try. Hopefully this will save you hours of frustration.

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *