StrawPoll API

First of all, we never intended to provide an API for StrawPoll. But since it's obviously already there and in internal use, we thought that it's more helpful to provide some information about it than trying to hide the endpoints.
Still, there is no reason to provide an API endpoint for voting, since we always give our best to only allow humans to vote on a poll. Therefore, we provide the following two endpoints for creating a poll programmatically as well es reading the results in real-time.

Endpoints

Create a Poll
We send a JSON-like formatted string to our API backend. It contains a 'poll' object like in the example below:
  • Request URL: https://api2.strawpoll.com/poll
  • Request Method: POST
  • Post Data (example): poll: { question: "Your poll question", answers: ["answer #1", "answer #2", "answer #3"], priv: true, co: true, ma: false, mip: false, enter_name: false, has_deadline: true, deadline: "2019-10-31T03:00:00.000Z", only_reg: false, vpn: false }
Options (Explanation)
  • priv: true/false - Private
  • 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)
  • has_deadline: true/false - Activate Deadline
  • deadline: Datetime - 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
Get Poll Results
Fetching poll results are fairly easy. The results are always delivered in realtime and the response contains JSON formatted data with the poll information as well es a timestamp in UNIX-time. Keep in mind that JSON fields are not sorted, so they can are returned in random order.
  • Request URL: https://api2.strawpoll.com/poll/$id (replace $id with your poll id, obviously ;)
  • Request Method: GET
  • Response (example): GET https://api2.strawpoll.com/poll/rae5gcp1
    Response: {"success":1,"poll":{"question":"How easy is embedding a StrawPoll?","is_valid":1,"answers":[{"id":434,"text":"Super easy","votes":5},{"votes":0,"text":"Somewhat easy","id":435},{"votes":0,"text":"Moderate","id":436},{"votes":0,"text":"Quite difficult","id":437},{"id":438,"text":"Very difficult","votes":0}],"hash":"rae5gcp1","del":0,"is_admin":0,"settings":{"mip":0,"has_deadline":0,"deadline":"0000-00-00T00:00:00Z","ma":0,"priv":0,"enter_name":0,"co":1,"vpn":0,"only_reg":0},"meta":{"description":null,"is_nsfw":0,"total_votes":5,"has_desc":0,"is_votable":1,"creator_country":"Germany","creator_username":"gkrambs","date_created":"2019-10-23T12:51:07Z"}},"message":"Success"}