Straw Poll API Information

Straw Poll API (v2)

The current version of the Straw Poll API is accessible via the https://strawpoll.me/api/v2/ endpoint. All resources listed here will be available in this endpoint. All resources will return data in JSON.

Polls resource

The polls resource is the primary interaction point for various tasks related to retrieving or creating polls.

GET

Polls can be retrieved from the API by specifying an ID to the polls resource.

The structure of the return value of this call is as follows:

  • id -- The ID of the poll.
  • title -- The title is the title of the poll, as entered when the poll was created.
  • options -- An array of strings to represent the options for the poll, ordered when poll was created.
  • votes -- An array of integers that correspond to the same indexed option which specify the current votes for that option. Vote index 0 will always be the votes for option index 0.
  • multi -- true if the poll can accept multiple votes from one user, false (or not present) otherwise.
  • dupcheck -- How to handle checking for duplicate votes. Acceptable values: normal (default),permissive and disabled.
  • permissive (DEPRECATED! Use "dupcheck" instead) -- true if the poll attempts to be more lenient in vote duplication checking, false (or not present) otherwise.
  • captcha -- true if the poll requires users to pass a CAPTCHA to vote, false (or not present) otherwise.

Examples

Retrieve data for poll ID 1:

Request 

https://strawpoll.me/api/v2/polls/1

Response

{
    "id": 1,
    "title": "What movie should we watch",
    "multi": false,
    "options": [
        "Sucker punch ",
        "Pirates of carribian ",
        "Prison logic",
        "Witchhunter"
    ],
    "votes": [
        13072,
        26807,
        4868,
        6425
    ]
}

POST

The POST action against the polls resource will create a new poll. This is rate limited to 100 polls created by any given user within 60 minutes.

The structure of POST body must be as follows:

  • title (required) -- The question that the poll is asking.
  • options (required, at least two options and at most 30 options) -- An array of strings to represent the options for the poll in the given order.
  • multi -- true if the poll can accept multiple votes from one user, false (or not present) otherwise.
  • dupcheck -- How to handle checking for duplicate votes. Acceptable values: normal (default),permissive and disabled.
  • permissive (DEPRECATED! Use "dupcheck" instead) -- true if the poll attempts to be more lenient in vote duplication checking, false (or not present) otherwise.
  • captcha -- true if the poll requires users to pass a CAPTCHA to vote, false (or not present) otherwise.

NOTE: You must specify a "Content-Type: application/json" header in your request.

The structure of the response is as follows:

  • id -- The ID of newly the poll.
  • title -- The title is the title of the poll, as entered when the poll was created.
  • options -- An array of strings to represent the options for the poll, ordered when poll was created.
  • multi -- true if the poll can accept multiple votes from one user, false (or not present) otherwise.
  • dupcheck -- How to handle checking for duplicate votes. Acceptable values: normal (default),permissive and disabled.
  • captcha -- true if the poll requires users to pass a CAPTCHA to vote, false (or not present) otherwise.

Examples

Create a new poll:

Request

https://strawpoll.me/api/v2/polls
{
   "title": "This is a test poll.",
   "options": [
       "Option #1",
       "Option #2"
   ],
   "multi": true
}

Response

{
    "id": 5223194,
    "title": "This is a test poll.",
    "options": [
        "Option #1",
        "Option #2"
    ],
    "multi": true,
    "dupcheck": "normal",
    "captcha": false
}

 


Can't find the answer you're looking for? Submit a ticket!

0 Comments

Please sign in to leave a comment.
Powered by Zendesk