--> HOME --> DEVELOPERS -->

Elections PEI API

The Elections PEI API is being developed to allow citizens interested in accessing the same public information available on the Elections PEI website, but through programmatic means. The API is being rolled out over the course of several years, and not all data is exposed through the API at this time.

Provincial Election Candidates

A TAB-delimited ASCII text file listing candidates for the current Provincial General Election is available. The data in this file is from the same source as the public List of Candidates page.

Provincial Election Results

Starting shortly after polls close for a Provincial General Election on regular polling day at 7:00 p.m., Elections PEI will make election results available to the public at http://results.electionspei.ca/. Also available, and updated on the same schedule with the same data, will be an XML representation of the election results, published as an RSS 2.0 feed with Elections PEI extensions to machine-encode candidate and vote total information.

Location and Name of XML File

The specific URL for the XML file will be published on this page before regular polling day.

Sample Data

Update Schedule

Elections PEI will update the RSS file once per minute starting at 7:00 p.m. so clients should not request the file more than once per minute.

District and Poll Data

The Provincial Electoral District Data API can be used to obtain more detailed information on provincial electoral districts and polling divisions.

Iterations

The XML file contains one <item> element for each polling division for which results have been received. Each <item> element contains a <electionspei:iteration> element that begins the a value of 1. Should a polling divisions results be modified at any point, another <item> for that poll will appear in the file, with the <electionspei:iteration> incremented by 1.

Political Party Abbreviations

The following political party abbreviations appear in the party attribute of the <electionspei:ballotcount> element:

Order of Candidates

The order of the candidate <electionspei:ballotcount> elements is the same as the order candidates appear on the ballot.

Votes Received

The pollvotes attribute of the <electionspei:ballotcount> element indicates the number of votes received for that candidate for that poll only whereas the totalvotes attribute indicates the total votes received for the candidate for all polls reporting.

Provincial Electoral District and Poll Finder

An API with similar capabilities to the Elections PEI Electoral District Finder is available. The API endpoint is:

http://www.electionspei.ca/api/provincial/districts/index.php

Parameters

The following search parameters are accepted:

Returned

The API will return either an error (if no results found, or if parameters are missing or wrongly-formatted) or a JSON or XML representation of all civic addresses that match the search parameters. For each matching address the electoral district and polling division, returning officer, and regular and advance poll locations are returned.

Error Codes Returned

Examples

http://www.electionspei.ca/api/provincial/districts/index.php?street_nm=PRINCE&street_no=100
http://www.electionspei.ca/api/provincial/districts/index.php?street_nm=PRINCE&street_no=100&comm_nm=Charlottetown&format=xml

API Version

Version 1.0 of the API was released on September 6, 2011. All XML and JSON produced by the API contains the API version number, as follows:

<api>
<version>1.1</version>
<date>2011-09-07</date>
</api>

Changes

Provincial Electoral District Data

All of the data about Prince Edward Island provincial electoral districts available from the Provincial Districts section of the Elections PEI website is also available in XML format via a REST-style API.

While there is no DTD available for the XML at present, the format is essentially self-documenting. Data is accessed through a hierarchical set of URLs, each of which offers an increasing level of specific detail; these URLs each map to the equivalent HTML URL for the website. For example, the main Provincial Districts page is found on the website at:

http://www.electionspei.ca/provincial/districts

The XML version of this data is found at:

http://www.electionspei.ca/xml/provincial/districts

URL Forms

XML data is available from URLs in the following form:

http://www.electionspei.ca/xml/provincial/districts
http://www.electionspei.ca/xml/provincial/districts/district[#]
http://www.electionspei.ca/xml/provincial/districts/district[#]/poll[#]

For example:

http://www.electionspei.ca/xml/provincial/districts
http://www.electionspei.ca/xml/provincial/districts/district12
http://www.electionspei.ca/xml/provincial/districts/district12/poll5

API Version

Version 1.0 of the API was released on September 1, 2011. All XML produced by the API contains the API version number, as follows:

<api>
<version>1.0</version>
<date>2011-09-01</date>
</api>

Changes

If you are developing applications against the API, you should have your code check the version number to ensure compatibility; when we make changes we'll increment the version and will document changes here.

Municipality Data

All of the data about Prince Edward Island municipalities available from the Municipalities section of the Elections PEI website is also available in XML format via a REST-style API.

While there is no DTD available for the XML at present, the format is essentially self-documenting. Data is accessed through a hierarchical set of URLs, each of which offers an increasing level of specific detail; these URLs each map to the equivalent HTML URL for the website. For example, the main Municipalities page is found on the website at:

http://www.electionspei.ca/municipalities

The XML version of this data is found at:

http://www.electionspei.ca/xml/municipalities

URL Forms

XML data is available from URLs in the following form:

http://www.electionspei.ca/xml/municipalities
http://www.electionspei.ca/xml/municipalities/[municipality]
http://www.electionspei.ca/xml/municipalities/[municipality]/ward[#]
http://www.electionspei.ca/xml/municipalities/[municipality]/ward[#]/poll[#]

For example, for Charlottetown you can retrieve the following:

http://www.electionspei.ca/xml/municipalities
http://www.electionspei.ca/xml/municipalities/charlottetown
http://www.electionspei.ca/xml/municipalities/charlottetown/ward1
http://www.electionspei.ca/xml/municipalities/charlottetown/ward1/poll1

API Version

Version 1.0 of the API was released on September 15, 2010. All XML produced by the API contains the API version number, as follows:

<api>
<version>1.1</version>
<date>2010-09-22</date>
</api>

Changes

If you are developing applications against the API, you should have your code check the version number to ensure compatibility; when we make changes we'll increment the version and will document changes here.

Questions and Feedback

Email api@electionspei.ca if you have questions or feedback concerning the API.