Results API¶
Here’s the API documentation for the ResultsController class from the provided Java file, following the format of the community documentation.
Results Controller¶
Base URL: /
| Method | Endpoint | Description |
|---|---|---|
| GET | /elections |
Retrieves a list of all elections. |
| GET | /locations/{electionId} |
Retrieves storage location information for a specific election. |
| GET | /results/{electionId}/{location} |
Retrieves results for a specific election and location based on the type. |
| POST | /upload |
Uploads election results via file(s). |
| GET | /import/{id} |
Imports previously uploaded election results using an ID. |
GET /elections¶
- Description: Retrieves a list of all elections.
- Response: List of
ElectionDTOobjects containing election details. - Example:
GET /locations/{electionId}¶
- Path Variable:
electionId(String) – ID of the election.
- Description: Retrieves storage location information for the specified election.
- Response:
StorageLocationDictionaryobject containing location details. - Example:
GET /results/{electionId}/{location}¶
- Path Variables:
electionId(String) – ID of the election.location(String) – Location for which the results are retrieved.
- Query Parameter:
type(String) – Type of results to retrieve:country,province, ormunicipality.
- Description: Retrieves results for the specified election and location based on the given type.
- Response:
- For
type=country:CountryResultsobject. - For
type=province:ProvinceResultsobject. - For
type=municipality:GemeenteResultsobject. - If the type is invalid, returns a 404 response.
- For
Note
The response structure remains the same across the different regions, only the response data class name is different.
- Example:
POST /upload¶
- Query Parameter:
file(MultipartFile[]) – Array of files to upload.
- Description: Uploads election results via one or more files.
- Response: String containing the ID of the uploaded results.
- Example:
GET /import/{id}¶
- Path Variable:
id(String) – ID of the uploaded files to import.
- Description: Imports previously uploaded election results using the given ID.
- Response: 200 OK if successful, 404 if the ID is invalid.
- Example:
Let me know if you’d like any modifications or additional details!