|
||||||||||||||||||||
Receiving Election Updates
Using the Returned Link for the Next RequestTo check for any new data since your previous request, it is strongly recommended that your client application use the link returned in the response for the next request, as described in Typical Workflow Overview. The next request link (link/@rel="next" in XML and "nextrequest" in JSON) is available in the responses of all of the Election API methods. If there have been changes since your previous request, the server sends back the HTTP/200 OK header and the new data in the response body. If there have been no changes, the server returns the HTTP/200 OK header and only the link for the next request in the response body. Conditional Requests
If you are not following the recommended practice of using returned 'next request' links and are repeatedly requesting the full set of election results, it is recommended that your client application send a conditional GET request to the AP Elections API server to check if there have been any updates since your last request. This practice helps avoid redundant processing of unchanged responses. AP Elections API responses include the ETag header; for example: HTTP/1.x 200 OK When making a conditional request, your client application must provide the AP Elections API server the ETag identifier of the previous request using the If-None-Match header. If the client’s document is the latest (based on this value), the server sends back the HTTP/304 Not Modified header without the response body. Alternatively, if the client’s document is outdated, the server sends back the HTTP/200 OK header and the new response body. Getting Election Report UpdatesTo request election report updates, use the 'next request' links, as described in Using the Returned Link for the Next Request. The list of reports returned when you submit a new search request for reports using optional filtering parameters always includes links to the latest available versions of the reports.
|