Tuesday, April 30, 2013

Perl and Open Government

For any interested in initiatives to make government data
more accessible, I ran across an interesting API put out by Civic Impulse –
the GovTrack API (http://www.govtrack.us/developers/api).The API allows queries to be made regarding many
of the bills being debated about in the US congress as well as the ability to
programmatically look up information pertaining to members of Congress.The available documentation for the API is
located at the link already provided, but a small Perl script below will
demonstrate the basics of accessing the API in Perl.

This script will query the API for bills regarding “fracking”
in the “112” session of congress and will simply print out the retrieved
results.

The
results are returned in the JSON format be default, but the API does allow for
parameters to be specified for XML or CSV based results as alternatives.For the code above the returned JSON would
look as follows: