Skip to main content
POST
Cast a vote

Authorizations

x-api-key
string
header
required

Your organisation's API key, supplied by Dizplai. Send it on every request. It isn't a secret, so it can ship in your app: what a fan does is protected by the fan's token.

Authorization
string
header
required

The fan's token from your own login, sent as Authorization: Bearer <token>: a signed-in fan's or a guest's. Dizplai checks it against your login's details, agreed when you're set up, and a guest's token carries the guest claim agreed at the same time. Needed to vote, upload, send a message, and read the fan's own vote or messages.

Headers

Idempotency-Key
string<uuid>
required

Required. A new UUID for each vote. If the connection drops, send the vote again with the same key: it's never counted twice.

Path Parameters

poll_id
string<uuid>
required

The poll's ID, from a list of experiences or polls. A poll's ID, a UUID.

Example:

"0192fa7b-8d41-7bbc-9b58-02311fc6ef8e"

Body

application/json

A fan's vote, the option they chose.

option_id
string<uuid>
required

One of the poll's options.

Example:

"01a1f97a-b538-778f-bad7-0c1c35ff701c"

Response

Received, not yet counted, with a snapshot of the poll's results that includes the vote. Show the snapshot straight away as a static view: it doesn't update, and a read straight after the vote may not include it yet. For live results, keep reading the poll. A later vote from the same fan also answers 202, with its own snapshot, but is never counted, so retrying after a lost response, with the same Idempotency-Key, is safe. To show the fan's choice on any device, use Get the fan's vote. If the poll closes before a retry, the retry answers not_open, and Get the fan's vote shows whether the first attempt counted.

The vote, received but not yet counted, with a snapshot of the poll's results that includes it.

option_id
string<uuid>
required

The option the fan voted for, as sent.

Example:

"01a1f97a-b538-778f-bad7-0c1c35ff701c"

results
Withheld · object
required

The poll's latest results with this vote added, for a static view straight after the vote. It doesn't update: for live results, keep reading the poll. withheld when fans may not see results yet, as results_visibility says.