Should I Cycle API

Document version

Date

Version

Author

Comments

25 August 2014

0.1

Matt Frear

Initial version

26 Sept 2014

0.2

Matt Frear

Added error response

Cycle endpoint

GET

/v1/cycle?location=London,uk&airquality=wa7,wa9

Arguments

Name

Type

Required

Description

location

string

1

The location for weather results.

e.g. London,uk

We will call OpenWeatherMap’s forecast service with this info http://api.openweathermap.org/data/2.5/weather?q=London,uk&units=metric

airquality

string

0..n

A site code to check for pollution.

This parameter can be passed as a comma-separated list to check multiple sites, e.g.

/v1/cycle?location=london&airquality=wa7,wa6

We will call London Air’s API for each location.

A list of available locations is at:

http://api.erg.kcl.ac.uk/AirQuality/Information/MonitoringSites/GroupName=London/Json

e.g. Putney’s is WA7.

We will call:

http://api.erg.kcl.ac.uk/AirQuality/Hourly/MonitoringIndex/SiteCode=WA7/Json

Response

Happy response

The response format will be JSON, with status code 200.

Name

Type

Description

city

string

The name of the City

temp

int

Temperature in degrees Celcius

symbol

int

OpenWeatherMap’s symbol for the current condition

windDegree

int

The wind direction in degrees from 0 to 359

windDirection

string

The 3 digit code for the wind direction, e.g. ENE

windSpeed

int

The wind speed in m/s

windStrength

string

A text description for the wind speed, e.g. “Moderate breeze”

pollution

[]

An array of pollution readings for each sensor requested

A pollution reading looks like

Name

Type

Description

name

string

The Sitecode requested, e.g. WA7

speciesCode

string

The type of reading, e.g. NO2

airQualityIndex

int

The level of pollution, where 1 = low and 10 = high

Error response

The response format will be JSON, with appropriate status code, e.g. 404.

Name

Type

Description

code

int

The error code, e.g. 404

message

string

A text description of what went wrong