POST /api/polls

create a new poll without a message

Also see messages#create to bind a poll to a message.

Success Response Code: 201


Param name Description

Value: Must be a Hash

question being asked by the poll

Value: Must be a String

answers that go with the question as well as an integer representing the answer's order within a poll

Value: Must be a Hash

Response Fields

poll[id] unique ID for the poll Integer
poll[question] question poll is asking String
poll[social_object_id] social object associated with this poll Integer
poll[my_response_id] if requesting user has answered the poll, id of their response Integer
poll[answers] potential answers to this poll Array<PollAnswer>
answer[id] answer's ID Integer
answer[text] text to display with the answer String
answer[response_count] number of votes so far this answer Integer

Example Curl Commands

curl -X POST -v --basic -u "" -H"Content-Type: application/json" -d'{"poll":{"question":"Hands up, who likes me?","poll_answers_attributes":{"1":{"answer":"YES!"},"2":{"answer":"You are OK"},"3":{"answer":"Absolutely not"}}}}'
#binding the created poll to a message
curl -X POST -v --basic -u "" -H "Content-Type: application/json" -d '{"message":{"poll_id":"5", "body":"creating a message with poll"}}'