Hacking Chicago's Unofficial Transit API

Recently, in our post on the Unofficial Chicago Transit Authority API we reported on this unofficial transit API for the CTA. The API enables developers to build applications that present CTA bus routes, schedules, and arrival predictions. This API is "unofficial" because it is not officially documented by the Chicago Transit Authority, but comes to us by virtue of developer Harper Reed.

Over at Ryan Graves' site, Daniel X. O'Neil, co-founder of the terrific Everyblock, has written an interesting article describing how the CTA bus tracking mashup was hacked by Harper which lead to the exposure of the underlying API:

Harper Reed ... saw every bus, everywhere, forevermore. And he wanted that data. "The power is not the mashup. It's the data. The data is the answer," says Harper. So he set out to separate the data from the mashup. He used Firebug, the nifty Firefox add-on, to monitor that network traffic (the communication that goes between the browser window and the server) that was driving the data to the page. This way, he found the URLs of the "endpoints" ... that control the entire Bus Tracker system.

Daniel's post describes in detail the reverse-engineering process Harper applied to derive the API from the CTA Bus Tracker web site. And besides the uncovering the existing endpoints and documenting them, Harper created some enhanced services and tools on top of the core service like caching and developing Bus Tracker widgets.

Harper set up a system for making regular queries to Bus Tracker and caching (storing) the results in a separate, stand-alone database over on a server that goes by the name of http://chicago.transitapi.com. This allows other developers to have a reliable database to ask questions of (see above) without having to ask the CTA all the time, and perhaps tax their servers or otherwise bother them. Like having a record of every instance of the river, stored forever.

The Chicago Bus Tracker Widget uses the Chicago Transit API to do cool things with this data. See also Chicago’s CTA Bus Tracker for iPhone and iPod Touch. I’d like to see more apps that use some of the more obscure data in the API. A “which bus should I take” app would be cool — just click to show where I am on a map and all the nearby bus stops with arriving buses (hat tip: Paul Smith).

Chicago Transit Authority Bus Tracker

For additional information on the API Harper ultimately derived, see our Chicago Transit Authority API profile and Harper's CTA Bus Tracker Mashup for more.

Be sure to read the next Government article: Congress SpaceBook and Hillary Clinton's FOAF Entry