12
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.
Specs
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.
Example
"My Awesome Poll"
["option 1", "I like pies", "I also like cakes"]
Output: http://strawpoll.me/7275997
This is code-golf, so shortest code in bytes wins!
2(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}
– Leaky Nun – 2016-04-04T07:26:15.2171"NOTE: You must specify a "Content-Type: application/json" header in your request." – Leaky Nun – 2016-04-04T07:27:09.847
The API sort of doesn't work, or at least it doesn't work like the docs say it does – cat – 2016-04-09T21:32:40.813
https://strawpoll.me/api/v2/polls
always responds with http 400 – cat – 2016-04-09T21:33:12.580Are you required to return the strawpoll in
http://
? Can I return inhttps://
instead? – Value Ink – 2016-04-10T01:56:48.413@KevinLau sure. – Maltysen – 2016-04-10T02:07:40.347
I can't get the API to respond properly with Factor or Python. @KevinLau have you tested yours? – cat – 2016-04-10T11:14:34.310
I have, and it returns a correct response that I can use to get the strawpoll link. – Value Ink – 2016-04-10T21:55:13.203