Skip to content

Representatives API Endpoints

kazvee edited this page Oct 30, 2023 · 2 revisions

This API returns the list of Representatives based on Zip code. Amplify does not store any data; this API leverages the Cicero API.

GET

Syntax

GET /{{api_version}}/official?search_postal={{postal_code}}&search_country={{2_character_country_code}}&key={{api_key}}

Returns

A list of JSON objects with Representative information for the provided Zip code.

Example Response Structure:

{
  "response": {
    "errors": [],
    "messages": [],
    "results": {
      "candidates": [
        {
          "count": {
            "to": number,
            "total": number,
            "from": number
          },
          "districts": [
            ... district objects ...
          ],
          "match_postal": string,
          "wkid": number,
          "match_country": string,
          "locator": string,
          "score": number,
          "match_region": string,
          "match_city": string,
          "match_addr": string,
          "y": number,
          "x": number,
          "match_subregion": string,
          "partial_match": boolean,
          "geoservice": string
        },
        ...
      ]
    }
  }
}

Troubleshooting errors

  • The Zip code must be in either the 5-digit Zip format (99999) or 9-digits Zip+4 format (99999-9999).
  • When only querying by Postal Code, a valid 2-character ISO 3166-1 alpha-2 code must be provided, for example: US.
  • The district_type resource returns a list of District Type objects in its results. The name_short property values of these objects can be used to filter resource responses.
  • The API will return a 200 OK code with message "errors": [ "No geocoding results found for address" ] if either:
    • the Zip code format is correct, but the value is not a valid zip code (such as 99999), or
    • the Zip code format is incorrect (such as dog).
  • This API leverages the Cicero API. This API is not free. As of October 2023, discussions are ongoing with Cicero regarding a group development key.
Clone this wiki locally