I’ve had a morbid fear of using API calls since I first heard the term years ago, just before I developed a morbid fear of JSON. Well, the latter didn’t last too long but JSON responses from websites can get awfully complicated, awfully quickly.

And that’s how tonight I ended up at the OpenWeatherMap site. It turns out I signed up for a free account a long time ago and forgot all about it – basically you go to their site – sign up with name, email address and a password and they give you an API KEY (or jumble of letters and numbers).

So – to check out their weather API today I put in their example link, added units=metric , my town and my api key.

Simple enough – and what comes back is simple enough, too. https://api.openweathermap.org/data/2.5/weather?units=metric&q=galera&appid={my_key}

Dead easy start. As for the Openweathermap icons – https://github.com/CodeExplainedRepo/Weather-App-JavaScript – it’s a short list of png files.

coord: {
lon: -2.5518,
lat: 37.7426
weather: [
id: 804,
main: “Clouds”,
description: “overcast clouds”,
icon: “04n”
base: “stations”,
main: {
temp: 18.5,
feels_like: 17.68,
temp_min: 17.44,
temp_max: 21.15,
pressure: 1015,
humidity: 49,
sea_level: 1015,
grnd_level: 919
visibility: 10000,
wind: {
speed: 0.77,
deg: 235,
gust: 0.84
clouds: {
all: 90
dt: 1634060515,
sys: {
type: 2,
id: 2004018,
country: “ES”,
sunrise: 1634019333,
sunset: 1634060247
timezone: 7200,
id: 2517432,
name: “Galera”,
cod: 200

If you’re as happy (or not) with JSON as I am, this should appeal unless you want lots of info. It simply tells me today’s weather…. but what about tomorrow as it is now 9pm – that would be nice. Later you’ll see I’m looking at a 3-hourly medium-term forecast version but that gets a little more involved.