Create a Poll via API
To create a poll, we send a JSON-like formatted string to our API backend. It
contains a 'poll' object like in the example below:
POST
https://strawpoll.com/api/poll
Post Data (JSON):
{
"poll": {
"title": "Your poll question",
"answers": ["answer #1","answer #2","answer #3"],
"ma": true
}
}
Poll Options & Their Explanations:
You can choose the following options. The default values are marked bold if the option is omitted.
- priv: true/false - Private or public
- co: true/false - Allow Comments
- ma: true/false - Multiple Answers allowed
- mip: true/false - Multiple votes per IP allowed
- enter_name: true/false - Voters have to enter their name (still in development)
- deadline: Datetime/undef - Specific datetime of deadline in zulu time
- only_reg: true/false - Allow only registered users to vote
- vpn: true/false - Allow VPN users to vote
- captcha: true/false - Background reCAPTCHA solving
Code Example on GitHub
Since a real example is always better than hard-to-read documentation, we would like to give you a
small example of a Python script that creates polls using the StrawPoll API.