Weather API Docs



Overview


The Golden West Weather API is a simple wrapper around Environment Canada's raw meteorological data feeds. There are three main components that make up the entire weather experience provided on Golden West portals:

Weather Data Grabber
We need to get our data from Environment Canada's servers and onto our own so we don't need to make requests over the internet all the time. This is the job of ec-grabber. It is written in C and runs every 15 minutes by cron job. It walks through Environment Canada's servers saving XML files as it goes. For more information see the source code.
Weather Data REST API
The Weather Data REST API uses the data cached by ec-grabber. It is written in Ruby using the Sinatra framework. Each request returns weather data in JSON format if successful. The response is created by converting the raw XML into Badgerfish style JSON. For better performance, the converted JSON is stored in a Memcached instance. For more information see the overview.
Joomla Weather Component
At the moment, all of Golden West's community portals run Joomla 1.5. A PHP component was developed in order to display the weather data on our portals. For more information, or to download the component, head to the git repository.

HTTP Requests


There are only four requests that can be made, all of them HTTP/1.1 GET requests and return JSON data if successful. Every call to the Golden West Weather API must have an api_key appended to the end of the request. In the future, the api_key will need to be provided by way of an HTTP request header.

All calls return HTTP/1.1 400 if station_code is invalid and HTTP/1.1 401 if an incorrect api_key was provided.

If the station_code received is currently experiencing weather warnings, they will be included in all responses.

Note: The api_key was not intended to be an authentication mechanism and it should not be thought of as entirely secure. It's intent is to simply eliminiate as many unauthorized API calls as possible without having to implement a robust authentication mechanism. To obtain an API key, contact Stefan Sobering or Dave Lehman.


Station Code Legend


Each Environment Canada weather station has a corresponding station_code. Below is a legend of all weather stations that Golden West utilizes along with their station_codes. You can sort the table columns by clicking on the column you wish to sort by.

station_codestation_namestation_province
s0000768AirdrieAB
s0000047CalgaryAB
s0000196HumboldtSK
s0000822Moose JawSK
s0000209AssiniboiaSK
s0000651KenoraON
s0000748Sioux LookoutON
s0000546DrydenON
s0000151SteinbachMB
s0000734RicherMB
s0000154VitaMB
s0000581KindersleySK
s0000300RosetownSK
s0000516EstevanSK
s0000515CarlyleSK
s0000514OxbowSK
s0000135VirdenMB
s0000137Turtle Mountain (Provincial Park)MB
s0000492BrandonMB
s0000372WeyburnSK
s0000192BroadviewSK
s0000129DrumhellerAB
s0000179Three HillsAB
s0000045EdmontonAB
s0000383High RiverAB
s0000767OkotoksAB
s0000068StrathmoreAB
s0000445WinklerMB
s0000444MordenMB
s0000171AltonaMB
s0000626Portage la PrairieMB
s0000355Swift CurrentSK
s0000248Maple CreekSK
s0000133ShaunavonSK
s0000195WatrousSK
s0000472Winnipeg - ForksMB
s0000193WinnipegMB
s0000337SpragueMB
s0000257CarmanMB
s0000172GretnaMB
s0000289Pilot MoundMB
s0000136MelitaMB
s0000088KillarneyON
s0000491SourisMB
s0000375WasagamingMB
s0000645Red DeerAB
s0000493CochraneAB
s0000297LacombeAB
s0000525Fort SimpsonNT
s0000797SaskatoonSK
s0000120ClaresholmAB
s0000788ReginaSK
s0000508DauphinMB
s0000490MinnedosaMB
s0000534GimliMB
s0000339Fisher BranchMB
s0000273Oak PointMB
s0000661Grande PrairieAB
s0000746Fort St. JohnBC
s0000509Dawson CreekBC
s0000510Edmonton (Int'l Aprt)AB

Last updated on June 27, 2013 at 4:00pm by [email protected].