There is a lot of talk about making data accessible via APIs, but there is also a lot of confusion about what this means, how to do it, and why it is beneficial when the average citizen cannot make heads or tails of an API.
API stands for “Application Programming Interface” but typically what we are discussing when we talk about APIs around data is a way to access data in a machine readable format. A machine readable format is something that is more or less understandable by a computer program, so that it may be used to present data in new and interesting ways.
The house.gov website has a listing of all representatives by state but a computer program has no way of knowing how to understand this listing. A more useful listing might look like an excel (or CSV) file that listed each congressperson’s name in the first column, state in the second, and so on.
This is the fundamental advantage of an API, it makes data available in a way that a computer program can understand so that more complicated things can be done by such a program. (eg. draw a map with states colored according to their representatives’ party affiliations)
A side effect of this computer readable format is that it is possible to ask more useful and specific questions of the data. When you go to the above house.gov site it is possible to get a listing of all Representatives, but it is impossible to say “show me all representatives that are Democrats from North Carolina” or “show me all representatives named John.” With an API this kind of query is typically very simple, as an example in the Sunlight Labs API this could be done by going to a URL like http://services.sunlightfoundation.com/api/legislators.get?state=NC&party=D.
It is the availability of these APIs that have allowed all sorts of interesting sites that combine data from multiple sources known as “mashups.” One of the earliest and most popular examples was a site called HousingMaps that combines Craigslist housing data with Google maps.
A handful of APIs exist to help make government data more accessible, through which it is now possible to make mashups using government data.
A rich sampling of them includes:
- Sunlight Labs API
- Capitol Words API
- FollowTheMoney API
- GovTrack.us API
- MapLight.org API
- NYTimes Campaign Finance API
- OpenSecrets API
- Project Vote Smart API
- Watchdog.net API
All of these can be used to pull the information available from these sites and do new and interesting things with it and even combine it with data from other sites to provide a more in-depth view than any single site or dataset can hope to offer.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.