Election API

Paqle Election API

The purpose of this API is to make the candidates, questionnaires and elections available as JSON.

The API is accessed via HTTPS GET requests and responds with UTF-8 encoded JSON when successful. When an error occurs, the relevant HTTP status code is used. Each API request must provide an HTTP Basic Authorization header, eg:

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

If this header is missing or the credentials are wrong, it results in a 401 status code and no data.

https://electionapi.paqle.net/{endpoint}/candidates

On this URL you'll find updates to candidates and their questionnaire submissions. Use this to maintain your own local index of candidates for the elections and questionnaires we've agreed to cover.

The response contains a Mark field, whose value can be used to get the next page of updates via the query parameter ?mark={mark}. Continue until you reach a page with no updates. Once you reach that point, start polling for updates at an interval of 1+ minutes.

You can also use the query parameter ?limit={limit} to control how many candidates are returned per page. Valid values are in the range 0 to 1000.

The response contains an ImageIds convenience field, containing all the textual identifiers for images that occur in the Updates. The images can be fetched from the images URL below. Use this to maintain your own local image mirror.

To find a specific candidate in the API, use the query parameter ?originalId={originalId}.

The Updates field contains a list of persons. The OriginalId is the ID of the person. The CurrentId is a version number for the person. The MergedIds is the IDs of persons that have been merged into this person. If you have any of these IDs in your index, they should be deleted or become redirects to the OriginalId. The Sections contain data about the person. Each section may have multiple records - if you only need e.g. a single name or a single email, then pick the first record. The Opinions contain the latest submission (if any) for the person for each questionnaire.

Each submission under Opinions has a Submitted time expressed as milliseconds after 1970-01-01T00:00:00Z (i.e. UNIX time in milliseconds), as well as an Answers field containing the latest answers, each with the following fields:

A person is considered a candidate for an election when there is an object in the Sections.Elections array where ElectionReference.OriginalId contains the given election ID and IsCandidate is true. In addition, the object may contain:

Persons never leave the API once they're in it. Instead, they're marked as Hidden if they're no longer a candidate for any of the relevant elections.

https://electionapi.paqle.net/{endpoint}/images/{imageId}

On this URL you can download images. When candidates upload a photo, they're asked to crop the image to a square, which we store as a 1200x1200 JPEG. Logos and photos uploaded by our staff may have different dimensions or be PNGs.

https://electionapi.paqle.net/{endpoint}/elections

On this URL you'll find the elections with list areas, parties and lists.

https://electionapi.paqle.net/{endpoint}/questionnaires

On this URL you'll find the questions from the questionnaires. Each question has an Id and one or more Versions: