congressapi / districts.getDistrictsFromZip

districts.getDistrictsFromZip gets all districts that overlap the area for a given zip code.

Parameters

The one required parameter for getDistrictsFromZip is 'zip' which should be a valid 5 digit zip code.

Errors

Errors are indicated by setting the HTTP status code to 400 and returning a text string describing the error. The following errors may be encountered districts.getDistrictsFromZip:

  • Missing Parameter: returned if zip parameter is not provided

Examples

districts.getDistrictsFromZip.xml?zip=12345

<response>
    <districts>
    <district>
        <state>NY</state>
        <number>21</number>
    </district>
    </districts>
</response>

districts.getDistrictsFromZip?zip=27511

{"response": 
    {"districts": [
      {"district": {"state": "NC", "number": "4"}}, 
      {"district": {"state": "NC", "number": "13"}}
    ]}
}