Social API reference

Social API · Stories

get/v1/communities/{community_id}/posts/{post_id}/poll-resultsAuth

Aggregate poll results for a post.

Returns counts per option, zero-filling options that received no votes, plus `total_votes`. The `question` and option `label` strings are echoed from `post.attributes.poll`.

Path parameters

community_id*string

Community UUID.

post_id*string

Post UUID containing the poll.

Response · 200 Aggregated poll results.

post_id*string · uuid

Post UUID the poll lives on.

Example: "bbbbbbbb-0000-0000-0000-000000000001"

question*string

Poll question, copied from post.attributes.poll.question.

Example: "Best dev tool?"

options*array

Each option with its vote count.

total_votes*number

Sum of counts across every option.

Example: 67

Example

Request

GET https://social.productcraft.co/v1/communities/{community_id}/posts/{post_id}/poll-results
Authorization: Bearer YOUR_TOKEN

Response

{
  "post_id": "bbbbbbbb-0000-0000-0000-000000000001",
  "question": "Best dev tool?",
  "options": [
    {
      "index": 0,
      "label": "VS Code",
      "count": 42
    }
  ],
  "total_votes": 67
}