Moderator note: https://strawpoll.me has officially shut down, and the linked API no longer appears to work or provide data. Therefore, new answers cannot actually do the task and so the challenge has been closed to prevent any new answers.

Strawpolls are great, and we use them in chat all the time for getting opinions on things. But they're kinda annoying to make since you need a webbrowser to make them, and everyone knows that I access PPCG only through SE APIs and curl. So I want you to write some code that uses Strawpoll's API to make a strawpoll with the given options.


Take as input a list in any reasonable format of options as strings, and a title which is also a string. Then use the API to make a strawpoll with that title and those options and output the url.

Multiples should not be allowed, duplicate checking should be enforced, and captchas should not be necessary.


"My Awesome Poll"
["option 1", "I like pies", "I also like cakes"]

Output: http://strawpoll.me/7275997

This is , so shortest code in bytes wins!

  • 4
    \$\begingroup\$ (Just to help everyone) TL;DR: do this: https://strawpoll.me/api/v2/polls{"title":"This is a test poll.","options":["Option #1","Option #2"],"multi": true} \$\endgroup\$
    – Leaky Nun
    Apr 4, 2016 at 7:26
  • 1
    \$\begingroup\$ "NOTE: You must specify a "Content-Type: application/json" header in your request." \$\endgroup\$
    – Leaky Nun
    Apr 4, 2016 at 7:27
  • \$\begingroup\$ The API sort of doesn't work, or at least it doesn't work like the docs say it does \$\endgroup\$
    – cat
    Apr 9, 2016 at 21:32
  • \$\begingroup\$ https://strawpoll.me/api/v2/polls always responds with http 400 \$\endgroup\$
    – cat
    Apr 9, 2016 at 21:33
  • 1
    \$\begingroup\$ I’ve closed this question because strawpoll.me has officially shut down, along with it's API, and so future answers to this are impossible \$\endgroup\$ Jan 3, 2023 at 22:03

3 Answers 3


Factor, 257 262 bytes

TUPLE: p title options dupcheck ;
[ command-line rest [ first ] [ rest ] bi "normal" p boa >json "https://strawpoll.me/api/v2/polls" <post-request> "application/json" "Content-Type" set-header http-request nip json> id>> 10 base> "http://strawpoll.me/" prepend ]

Expects a name as the first command-line arg, then options after that.

Requires com-auto-use.


TUPLE: poll
  title options dupcheck ;

: post-json ( post-data url -- response data )
    "application/json" "Content-Type" set-header
  http-request ;

: strawpoll-main ( -- )
  command-line rest [ first ] [ rest ] bi "normal" poll boa
  >json "https://strawpoll.me/api/v2/polls" post-json nip
  json> id>> 10 base> "http://strawpoll.me/" prepend print ;

Ruby 2.2.4 + HTTParty: 129 bytes

Anonymous function; returns a string with the strawpoll URL. Remember to install the HTTParty gem before running.


If the URL can be returned with https:// instead of http://, 126 bytes:

  • \$\begingroup\$ Did you set the Content-Type: application/json header? \$\endgroup\$
    – cat
    Apr 10, 2016 at 11:15
  • \$\begingroup\$ I got a proper response back, so I'd assume that HTTParty does that for me already. \$\endgroup\$
    – Value Ink
    Apr 10, 2016 at 21:53
  • \$\begingroup\$ This gem won't install, which is really annoying since I'd like to figure out why I keep getting HTTP 400. \$\endgroup\$
    – cat
    Apr 10, 2016 at 23:14
  • \$\begingroup\$ What's your Ruby version? I updated mine to the version I have, and the gem says it needs 1.9.3+ \$\endgroup\$
    – Value Ink
    Apr 10, 2016 at 23:56

Python, 145 bytes

lambda t,o:post('https://api.strawpoll.com/v3/polls',json={"title":t,"poll_options":[{"value":x}for x in o]}).json()["url"]
from requests import*

A function which takes in a string for the title and set of strings for the options and returns the URL. I am not including an ATO/TIO link because you aren't able to do requests from those platforms.

In the intervening years since this question was asked, the original strawpoll API has become defunct, so I'm using the newer API, which is unfortunately more verbose.


Not the answer you're looking for? Browse other questions tagged or ask your own question.