SunlightLabs API
This was a response from users who had complained about the quality supplied in places.getDistrictsFromZip.php.
Note: that these data are from 109th Congress. At time of writing (4/5/07), the 110th Congressional Directory has not been published.
These data come from the 109th Congressional Directory and are believed to be accurate capture of that data. That is, for each representative, the congressional directory lists all the 5 digit zipcodes that they represent. Here is an example for Alabama.
Note: individual 5-digit zips may lie within more than one district.
Following the US census Bureau, for At-Large states, district is '00'. For DC, district is '98'.
These are all $_GET parameters.
zip (required)
apikey (required)
metadata (optional)
output (optional)
http://api.sunlightlabs.com/places.109th.getDistrictsFromZip5.php?zip=10941 &apikey=23kj234kjb3kjbcl87ds
says give me the 1 or more districts containing the zipcode 10941.
For the default JSON:
{ "zip" : "10941", "districts": [ { "state" : "NY", "district" : "19" },
{ "state" : "NY", "district" : "22" } ] }
and (At-Large states)
{ "zip" : "99701", "districts": [ { "state" : "AK", "district" : "00" } ] }
and
{ "zip" : "20005", "districts": [ { "state" : "DC", "district" : "98" } ] }
For XML:
<results>
<zip>10941</zip>
<districts>
<district state="NY">19</district>
<district state="NY">22</district>
</districts>
</results>
If there is an error: a plain text string will be returned:
100: invalid API key
101: API key not valid for this method
205: invalid zip5

