AP VoteCast Response

 

ON THIS PAGE      Show

 

 

 

 

On success, returns the standard HTTP status code of "200 – OK" and the response in the requested format (XML or JSON). The response contains a list of AP VoteCast JSON result files for the specified election date and optional filtering parameters (for example, state or election code). For information about error codes, see API Codes.

Response Elements

The following elements describe the response:

 

XML

JSON

Description

Votecasts

"votecasts"

 

@ApiVersion

"apiVersion"

The API version number; for example, 3.1.

@ApiBuild

"apiBuild"

The API build number; for example, 3.1.104.

@Timestamp

"timestamp"

The date and time (in W3C XML Schema’s xs:dateTime format) when the response was returned.

@ID

"id"

The URL for the list of VoteCast files.

@Title

"title"

The response name.

link

"nextrequest"

Indicates a link for the next request that must be used to request data newer than the data in the previously returned response.

@rel="next"

@href

 

The specific URL for the next request.

The following elements are returned for each VoteCast result file:

 

XML

JSON

Description

Votecast

 

Contains the data and metadata associated with an individual report.

ID

"id"

The result file ID, which is the same as the name of the result file name.

Type

"type"

The result file type: "Summary."

ResultsType

"resultsType"

Live/test data indicator (l indicates live data; t indicates test data).

Transform

"transform"

Specifies whether the file includes candidate information (postclose) or not (preclose). For more information, see AP VoteCast Data Delivery Schedule.

Code

"code"

Election code used by AP VoteCast. For the list of values, see Election Codes.

Stage

"stage"

Results delivery stage. Ad hoc deliveries can include an additional letter; for example, "3A".

Party

"party"

The party code for the election event if applicable.

StatePostal

"statePostal"

The geo code, such as a two-character state postal code or "US" for national VoteCast results.

LastUpdated

"lastUpdated"

The date and time (in W3C XML Schema’s xs:dateTime format) when the result file was generated.

ElectionDate

"electionDate"

Date of the election day.

ContentLink

"contentLink"

Contains the direct link to the JSON result file.

Response Headers (Optional)

Header

Description

AP_SIGNATURE_SHA256

If includesignature=sha256 or includesignature=eddsa was specified in the request, contains the digital signature. For more information, see Requesting Digital Signatures.

AP_SIGNATURE_EDDSA

VoteCast File List Example

XML  |  JSON

This example shows a list of sample VoteCast result files with test data for the 2024-11-05 election date in XML and JSON.

 

For an example of a VoteCast JSON result file, see Result Files.