prompts vote
Luke Baker edited this page Apr 8, 2014
·
5 revisions
Description: Submit vote for a prompt, optionally requesting next prompt
Format: XML, json
URL: POST /questions/7/prompts/1/vote.xml?next_prompt%5Bvisitor_identifier%5D=owner&next_prompt%5Bwith_appearance%5D=true&vote%5Bdirection%5D=left
Parameters:
-
vote: required, hash: Hash containing the following fields:
- visitor_identifier: optional, string: Identifier of voter. If not specified, the default visitor (the question owner) will be used.
- direction: required, string = “left” | “right”: The direction of the winning choice
- appearance_lookup: optional, string: ID of the prompt’s appearance (if it was generated using :with_appearance)
- time_viewed: optional, int: Number of miliseconds between appearance and vote
- force_invalid_vote: optional, boolean: force this vote to be considered invalid.
- tracking: optional, mixed: arbitrary data that will get serialized to the database for this vote
-
next_prompt: optional, hash: Request the next prompt to be returned immediately
- visitor_identifier: optional, string: Identifier of voter
- with_appearance: optional, bool: Whether request should generate a new appearance
- algorithm: optional, string = “catchup”: Use catchup algorithm for selecting the next prompt
- with_visitor_stats: optional, bool: Whether to return extra parameters visitor_votes and visitor_ideas
Returns:
Vote object OR prompt object if next_prompt is specified.
<?xml version="1.0" encoding="UTF-8"?>
<prompt>
<created-at type="datetime">2010-07-02T16:12:17+00:00</created-at>
<id type="integer">4</id>
<question-id type="integer">7</question-id>
<tracking nil="true"></tracking>
<updated-at type="datetime">2010-07-02T16:12:17+00:00</updated-at>
<votes-count type="integer">1</votes-count>
<left-choice-text>foo</left-choice-text>
<right-choice-text>baz</right-choice-text>
<left-choice-id type="integer">9</left-choice-id>
<right-choice-id type="integer">11</right-choice-id>
<appearance_id>311d659ef02e2074e28ac725ec258a34</appearance_id>
</prompt>
or if :next_prompt is defined:
<?xml version="1.0" encoding="UTF-8"?>
<prompt>
<created-at type="datetime">2010-07-08T10:49:51+00:00</created-at>
<id type="integer">16</id>
<question-id type="integer">7</question-id>
<tracking nil="true"></tracking>
<updated-at type="datetime">2010-07-08T10:49:51+00:00</updated-at>
<votes-count type="integer">0</votes-count>
<left-choice-text>NEWNEW2</left-choice-text>
<right-choice-text>foo</right-choice-text>
<left-choice-id type="integer">18</left-choice-id>
<right-choice-id type="integer">9</right-choice-id>
</prompt>
Notes:
- Silently ignores :with_appearance if :visitor_identifier not present
- See prompts-skip