Since I’m going to have to build an API for my app before I write any code I’m going to think about what my API should look like.
To do this I’m going to do some investigation of what APIs are out there which my API will call.
For air quality I found the London Air API. It looks pretty good, easy to use with good documentation. I can get the current air quality for Putney by calling: http://api.erg.kcl.ac.uk/AirQuality/Hourly/MonitoringIndex/SiteCode=WA7/Json
Which Weather API to use?
Yahoo
Choosing a weather API was more difficult. I was originally going to use Yahoo’s weather API, I can get London’s weather like so: http://weather.yahooapis.com/forecastrss?w=44418&u=c
But I couldn’t see any “chance of rain in the next hour” metric in the results. Which is annoying, because Yahoo’s own iOS weather app has that information nicely presented. Using Charles proxy I could see that Yahoo’s iOS app uses https://mobileweather.yql.yahooapis.com and not their own public weather API. Its query for London looks like “select * from yahoo.media.weather.oauth where flickrGroup=’1463451@N25′ AND hourly=’TRUE’ AND hours=’23’ AND days=’10’ AND pw=’1316′ AND ph=’1316′ AND uv=’TRUE’ AND unit=’C’ AND mp=’true’ AND lang=’en’ AND woeid in (44418)”
Anyway, without the “chance of rain in next hour” metric I started looking elsewhere.
Forecast.io
I took a look at Forecast.io’s API and their API looked great – easy to use and it has the hourly forecast which is what I want. But when I tested its results for London a couple of things bothered me. 1. it’s in imperial only, not metric. OK that’s not a showstopper, I can do conversions to metric in my API. But the wind direction was plain incorrect. The weather was blowing an easterly but their API was saying it’s a southerly. Bad data = showstopper.
OpenWeatherMap
I had a quick look at OpenWeatherMap’s API and their API has super easy documentation (London current conditions here and 3 hour forecast here) but I couldn’t see hourly data there either.
Met Office
The UK’s own Met Office has numerous APIs over at http://www.metoffice.gov.uk/datapoint.
But bloody hell, it’s hard work trying to figure out which API call to use and how to call it. The “UK daily site specific forecast” was one option – here’s its results for Wandsworth. But that only has the forecast conditions at noon and midnight. All I want to know is what the conditions are now. Where’s that? Ah let’s try the “UK 3-hourly site-specific forecast” (Wandsworth here). Again, it’s 3 hour forecast feed. All I want to know is the conditions right now and for the next hour. I guess that’s as close as I’m going to get though.
Conclusion
I couldn’t find the perfect weather API – only Forecast.IO had a rain prediction for the next hour but their wind direction was incorrect. OpenWeatherMap and Met Office both had 3 hour predictions, but OpenWeatherMap’s documentation is better, their Free account has better terms, and they work worldwide and not UK only so I’m gonna use them.
Winner: OpenWeatherMap
Image may be NSFW.
Clik here to view.

Clik here to view.
