Polls

Supports creating, getting, answering, and deleting polls.

Create a poll

Request:

POST https://polls.reactive.live/api/v1/polls

Body:

Name Type Required Description
id string Yes Id of the stream you'd like poll the audience of.
question string Yes The poll's question. Maximum of 60 characters.
choices array(string) Yes The polls answerable choices. Must have a minimum of two choices and a maximum of three choices.

Example command:

curl -i  \
  -H "Content-Type: application/json" \
  -d '{"id": "6935357a-8d71-45f2-9a0f-ddaed705b43a", "question": "What is the best flavor of ice cream?", "choices": ["Chocolate", "Vanilla","Strawberry"]}' \
  https://polls.reactive.live/api/v1/polls/

Response:

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": "6935357a-8d71-45f2-9a0f-ddaed705b43a",
    "question": "What is the best flavor of ice cream?",
    "choices": {
      "chocolate":  { 
        "count": 0,
        "percentage": 0,
      },
      "Vanilla": { 
        "count": 0,
        "percentage": 0,
      },
      "Strawberry":  { 
        "count": 0,
        "percentage": 0,
      },
    }
}

Get a poll

Request:

GET https://polls.reactive.live/api/v1/polls/:stream-id

Parameters:

Name Type Required Description
stream-id string Yes The id of the stream you'd like to poll.

Example command:

curl -i  \
  -H "Content-Type: application/json" \
  https://polls.reactive.live/api/v1/polls/6935357a-8d71-45f2-9a0f-ddaed705b43a/

Response:

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": "6935357a-8d71-45f2-9a0f-ddaed705b43a",
    "question": "What is the best flavor of ice cream?",
    "choices": {
      "chocolate":  { 
        "count": 400,
        "percentage": 40,
      },
      "Vanilla": { 
        "count": 400,
        "percentage": 40,
      },
      "Strawberry":  { 
        "count": 200,
        "percentage": 20,
      },
    }
}

Answer a poll

Request:

POST https://polls.reactive.live/api/v1/polls/:stream-id/answer

Parameters:

Name Type Required Description
stream-id string Yes The id of the stream you're answering a poll in.

Body:

Name Type Required Description
choice string Yes The poll's choice you'd like to select.

Example command:

curl -i  \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"choice": "Chocolate"}' \
  https://polls.reactive.live/api/v1/polls/6935357a-8d71-45f2-9a0f-ddaed705b43a/answer

Response:

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

Delete a poll

Request:

DELETE https://polls.reactive.live/api/v1/polls/:stream-id

Parameters:

Name Type Required Description
stream-id string Yes The id of the stream you're deleting a poll in.

Example command:

curl -i  \
  -H "Content-Type: application/json" \
  -X DELETE \
  https://polls.reactive.live/api/v1/polls/6935357a-8d71-45f2-9a0f-ddaed705b43a

Response:

HTTP 204 NO CONTENT
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept