Skip to content

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 ElectionDTO objects containing election details.
  • Example:
    GET /elections
    

GET /locations/{electionId}

  • Path Variable:
    • electionId (String) – ID of the election.
  • Description: Retrieves storage location information for the specified election.
  • Response: StorageLocationDictionary object containing location details.
  • Example:
    GET /locations/TK2023
    

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, or municipality.
  • Description: Retrieves results for the specified election and location based on the given type.
  • Response:
    • For type=country: CountryResults object.
    • For type=province: ProvinceResults object.
    • For type=municipality: GemeenteResults object.
    • If the type is invalid, returns a 404 response.

Note

The response structure remains the same across the different regions, only the response data class name is different.

  • Example:
    GET /results/TK2023/Amsterdam?type=province
    

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:
    POST /upload
    Content-Type: multipart/form-data
    file: [file1, file2]
    

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:
    GET /import/abc123
    

Let me know if you’d like any modifications or additional details!