Vote

Vote Service

Web service endpoints for votes on polls.

Create Vote

POST /votes/{pollID}

Cast a vote on the specified poll. Some polls allow multiple votes or a single vote.

Path Parameters:
NameTypeRequiredDescription
pollIDStringtrueID of the poll for which to cast a vote
Takes:
  • JSON array with the options the user is voting for
  • Return Status:
    HTTP Status CodeDescription
    201 (Created)Request was successful
    400 (Bad Request)If any input field is malformed, or the ID does not specify a poll
    403 (Forbidden)If you are not allowed to perform this operation
    404 (Not Found)If the specified poll does not exist

    Get Votes

    GET /votes/{pollID}

    Return the number of votes cast for each poll option.

    Path Parameters:
    NameTypeRequiredDescription
    pollIDStringtrueID of the poll for which to retrieve votes
    Retrieves:
  • JSON array where each entry has an option attribute and a count attribute that holds the number of votes the option received.
  • Return Status:
    HTTP Status CodeDescription
    200 (OK)Request was successful
    400 (Bad Request)An input field is missing or malformed
    403 (Forbidden)You are not allowed to access the specified poll
    404 (Not Found)The specified poll does not exist