Cast a fan's vote
curl --request POST \
--url https://api.dizplai.com/v1/polls/{poll_id}/votes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"option_id": "opt_01M7WQND9RKTH6WF72R2VFKZ1S"
}
'import requests
url = "https://api.dizplai.com/v1/polls/{poll_id}/votes"
payload = { "option_id": "opt_01M7WQND9RKTH6WF72R2VFKZ1S" }
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({option_id: 'opt_01M7WQND9RKTH6WF72R2VFKZ1S'})
};
fetch('https://api.dizplai.com/v1/polls/{poll_id}/votes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dizplai.com/v1/polls/{poll_id}/votes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'option_id' => 'opt_01M7WQND9RKTH6WF72R2VFKZ1S'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dizplai.com/v1/polls/{poll_id}/votes"
payload := strings.NewReader("{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dizplai.com/v1/polls/{poll_id}/votes")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dizplai.com/v1/polls/{poll_id}/votes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}Poll API
Cast a fan's vote
From a client’s fan app, with the app’s publishable key in x-api-key and the fan’s token in Authorization. A vote counts once per fan and item, so a retry is safe: a second vote, even with a different choice, is accepted (202) and never counted.
POST
/
polls
/
{poll_id}
/
votes
Cast a fan's vote
curl --request POST \
--url https://api.dizplai.com/v1/polls/{poll_id}/votes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"option_id": "opt_01M7WQND9RKTH6WF72R2VFKZ1S"
}
'import requests
url = "https://api.dizplai.com/v1/polls/{poll_id}/votes"
payload = { "option_id": "opt_01M7WQND9RKTH6WF72R2VFKZ1S" }
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({option_id: 'opt_01M7WQND9RKTH6WF72R2VFKZ1S'})
};
fetch('https://api.dizplai.com/v1/polls/{poll_id}/votes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dizplai.com/v1/polls/{poll_id}/votes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'option_id' => 'opt_01M7WQND9RKTH6WF72R2VFKZ1S'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dizplai.com/v1/polls/{poll_id}/votes"
payload := strings.NewReader("{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dizplai.com/v1/polls/{poll_id}/votes")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dizplai.com/v1/polls/{poll_id}/votes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"option_id\": \"opt_01M7WQND9RKTH6WF72R2VFKZ1S\"\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 499,
"request_id": "<string>",
"detail": "<string>",
"errors": [
{
"pointer": "<string>",
"message": "<string>"
}
]
}Authorizations
Which app is calling, and its usage plan: a platform's secret key, from servers only, or an app's publishable key (pk_live_...), safe in app code. It identifies the app and grants nothing on its own.
The fan's token, from the client's own login.
Path Parameters
Pattern:
^pol_[0-9A-HJKMNP-TV-Z]{26}$Example:
"pol_01JBX7Q3A1B2C3D4E5F6G7H8J9"
Body
application/json
One of the poll's options.
Pattern:
^opt_[0-9A-HJKMNP-TV-Z]{26}$Example:
"opt_01M7WQND9RKTH6WF72R2VFKZ1S"
Response
Accepted and queued. No body.

