Skip to content

Instantly share code, notes, and snippets.

@33mhz
Created March 26, 2018 01:25
Show Gist options
  • Save 33mhz/15c63970431411c63080ec7190196e02 to your computer and use it in GitHub Desktop.
Save 33mhz/15c63970431411c63080ec7190196e02 to your computer and use it in GitHub Desktop.
Create Pnut.io Poll
curl "https://api.pnut.io/v0/polls" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "Content-Type: application/json" \
    -d "{
  \"type\":\"general.poll\",
  \"prompt\":\"What is Pnut to you?\",
  \"options\":[
    {
      \"text\":\"My jam\"
    },
    {
      \"text\":\"I'm jelly with it\"
    },
    {
      \"text\":\"Almonds\"
    },
    {
      \"text\":\"These options are nuts\"
    }
 ],
  \"duration\":20160,
  \"is_public\":true
}" \
    -X POST \
    -H "X-Pretty-Json: 1"
curl "https://api.pnut.io/v0/posts?include_post_raw=1" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "Content-Type: application/json" \
    -d "{
  \"text\":\"Attached is a poll -- answer it when you can :D\",
  \"raw\":[
{
  \"type\":\"io.pnut.core.poll-notice\",
  \"value\":{
    \"+io.pnut.core.poll\": {
      \"poll_id\": 1,
      \"poll_token\": \"token\"
    }
  }
}
]}" \
    -X POST \
    -H "X-Pretty-Json: 1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment