The first open API in the stream

The location API we built as part of hackbmth’s Transport Hackday in February

Published on 18th February 2015 by Jonathan Ginn

Since we launched the open data portal in May last year, it has been growing slowly but steadily as a resource for Bournemouth-based data. As an unfunded project the time we set aside to manage requests and clean up data gets used up quickly, and as such it’s currently missing the access to data that will really spark innovation; APIs and real time feeds.

We’ve known for a long time that what it really needs is for enterprising developers to kickstart their own APIs and make them open, but we also know that the best way to communicate this is to make a few ourselves first. The hackbmth Transport Hackday was the perfect opportunity for us to put some time in to do just that.

In the run up to the events, Tom and I had discussed creating the building blocks that would enable interesting apps. At the briefing, it seemed like being able to find key locations around town like taxi ranks and Co-Wheels car club bays could be a really useful tool in creating the ‘big picture’ multi-modal apps that a lot of people were starting to talk about.

We requested the taxi rank information from the Council through the Bournemouth Data Stream – but when it arrived it wasn’t great. It almost entirely consisted of a road name (all in caps), then a description of where the taxi rank is. No LatLng, no Eastings/Northings. Harry Wood from TransportAPI, explained that this was due to licensing restrictions (…something we’re keen to understand more about), but the first job was obvious; a manual clean up of the data :/

IMG_20150207_120652

As a front-end dev, I have little experience building and structuring HTTP APIs, but for me that’s what the day is about; stepping out of your comfort zone and learning new skills.

Alex recommended and provided a simple starting block using Silex, a PHP micro framework based on Symfony Components, and the Hypertext Application Language (HAL) JSON Standard to make the discovery of the endpoints and the resources they contain self explanatory. This helps us by making the API self documenting.

Thanks to Viaduct‘s offer of hosting hackbmth projects, we had a home for the project. A few minutes later we had a barebones API running on Viaduct pulling in dummy data.

After a lot of time spent with Google Maps and Open Street Map finding static transport locations in the area we had sanitised data for about 50 ranks, including the ranks that have controversially moved, and added the 8 Co-Wheels car club bays. We also came across a few helipads, so there’s an API for that too should you need it.

The code is all open source on GitHub, and you can hit up the API from the stream for your projects.

Bournemouth on GitHub

There’s now a Bournemouth organisation on GitHub. It seemed like a good idea as an open central hub for projects, so if you want to put your project on there or help contribute I can add you to the org. Tweet me!

Published on 18th February 2015

Developer Evangelist

Jonathan Ginn