PollChoices API

BETA: This API resource is not finalized, and there could be breaking changes before its final release.

Manage choices for polls

A PollChoice object looks like:

{
  // The unique identifier for the poll choice.
  "id": 1023,
  // The id of the poll this poll choice belongs to.
  "poll_id": 1779,
  // Specifies whether or not this poll choice is a 'correct' choice.
  "is_correct": true,
  // The text of the poll choice.
  "text": "Choice A",
  // The order of the poll choice in relation to it's sibling poll choices.
  "position": 1
}

List poll choices in a poll Polling::PollChoicesController#index

BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.

GET /api/v1/polls/:poll_id/poll_choices

Returns the list of PollChoices in this poll.

Example Response:

{
  "poll_choices": [PollChoice]
}

Get a single poll choice Polling::PollChoicesController#show

BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.

GET /api/v1/polls/:poll_id/poll_choices/:id

Returns the poll choice with the given id

Example Response:

{
  "poll_choices": [PollChoice]
}

Create a single poll choice Polling::PollChoicesController#create

BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.

POST /api/v1/polls/:poll_id/poll_choices

Create a new poll choice for this poll

Request Parameters:

Parameter Type Description
poll_choices[][text] Required string

The descriptive text of the poll choice.

poll_choices[][is_correct] boolean

Whether this poll choice is considered correct or not. Defaults to false.

poll_choices[][position] integer

The order this poll choice should be returned in the context it's sibling poll choices.

Example Response:

{
  "poll_choices": [PollChoice]
}

Update a single poll choice Polling::PollChoicesController#update

BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.

PUT /api/v1/polls/:poll_id/poll_choices/:id

Update an existing poll choice for this poll

Request Parameters:

Parameter Type Description
poll_choices[][text] Required string

The descriptive text of the poll choice.

poll_choices[][is_correct] boolean

Whether this poll choice is considered correct or not. Defaults to false.

poll_choices[][position] integer

The order this poll choice should be returned in the context it's sibling poll choices.

Example Response:

{
  "poll_choices": [PollChoice]
}

Delete a poll choice Polling::PollChoicesController#destroy

BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.

DELETE /api/v1/polls/:poll_id/poll_choices/:id

204 No Content response code is returned if the deletion was successful.