Skip to main content

Documentation Index

Fetch the complete documentation index at: https://api.docs.onlydrams.app/llms.txt

Use this file to discover all available pages before exploring further.

Submits a vote on a poll attached to a community post.

URL Parameters

community_id
integer
required
The ID of the community
id
integer
required
The ID of the community post
poll_id
integer
required
The ID of the poll

Request Body

poll_option_ids
array
required
Array of poll option IDs to vote for

Returns

Returns the updated poll object with current vote counts.
curl -X POST https://api.onlydrams.app/odis/v1/communities/1/posts/2/polls/1/vote \
     -H "Authorization: Bearer $ACCESS_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "poll_option_ids": [1]
     }'
{
  "id": 1,
  "question": "What's your favorite whisky type?",
  "multiple_choice": false,
  "expires_at": "2024-11-15T00:00:00Z",
  "total_votes": 43,
  "poll_options": [
    {
      "id": 1,
      "option_text": "Single Malt",
      "vote_count": 26,
      "position": 1
    },
    {
      "id": 2,
      "option_text": "Bourbon",
      "vote_count": 17,
      "position": 2
    }
  ]
}
{
  "id": 2,
  "question": "Which features do you want?",
  "multiple_choice": true,
  "expires_at": null,
  "total_votes": 15,
  "poll_options": [
    {
      "id": 3,
      "option_text": "Feature A",
      "vote_count": 10,
      "position": 1
    },
    {
      "id": 4,
      "option_text": "Feature B",
      "vote_count": 8,
      "position": 2
    },
    {
      "id": 5,
      "option_text": "Feature C",
      "vote_count": 12,
      "position": 3
    }
  ]
}

Error Responses

{
  "message": "You have already voted on this poll"
}
{
  "message": "This poll has expired"
}
{
  "message": "Poll does not belong to this post"
}
{
  "message": "Invalid poll option IDs"
}

Notes

  • Authorization: Any authenticated user with access to the post
  • One Vote: Can only vote once per poll
  • Single Choice: Only one option ID allowed for single-choice polls
  • Multiple Choice: Multiple option IDs allowed for multiple-choice polls
  • Expiration: Cannot vote on expired polls
  • Access: Must have access to post based on tier membership
  • Vote Removal: Use remove vote endpoint to change vote