curl --request PATCH \
--url https://pollunit.com/api/v1/polls/{poll_id}/votes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vote": {
"vote": 1,
"vote_text": "<string>"
}
}
'import requests
url = "https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}"
payload = { "vote": {
"vote": 1,
"vote_text": "<string>"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({vote: {vote: 1, vote_text: '<string>'}})
};
fetch('https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}', 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://pollunit.com/api/v1/polls/{poll_id}/votes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'vote' => [
'vote' => 1,
'vote_text' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pollunit.com/api/v1/polls/{poll_id}/votes/{id}"
payload := strings.NewReader("{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "Votes::RatingVote",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"option_id": "<string>",
"loser_option_id": "<string>",
"voter_id": "<string>",
"vote": 123,
"vote_date": "2023-12-25",
"vote_text": "<string>",
"paid": true,
"voting_category_id": 123
}{
"error": "Unauthorized"
}{
"error": "Not Found"
}{
"error": "Unprocessable Entity",
"errors": {}
}Update vote
Changes the value of a vote. The vote has to belong to the requesting user and the poll has to still accept votes. Admins may additionally change the votes of other participants of voting and table polls. Polls that sell votes do not allow lowering vote, and answer with the payment page instead of the vote when more votes are bought. For polls with vote_per_day only the votes of the current day can be changed.
curl --request PATCH \
--url https://pollunit.com/api/v1/polls/{poll_id}/votes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vote": {
"vote": 1,
"vote_text": "<string>"
}
}
'import requests
url = "https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}"
payload = { "vote": {
"vote": 1,
"vote_text": "<string>"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({vote: {vote: 1, vote_text: '<string>'}})
};
fetch('https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}', 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://pollunit.com/api/v1/polls/{poll_id}/votes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'vote' => [
'vote' => 1,
'vote_text' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pollunit.com/api/v1/polls/{poll_id}/votes/{id}"
payload := strings.NewReader("{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pollunit.com/api/v1/polls/{poll_id}/votes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vote\": {\n \"vote\": 1,\n \"vote_text\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "Votes::RatingVote",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"option_id": "<string>",
"loser_option_id": "<string>",
"voter_id": "<string>",
"vote": 123,
"vote_date": "2023-12-25",
"vote_text": "<string>",
"paid": true,
"voting_category_id": 123
}{
"error": "Unauthorized"
}{
"error": "Not Found"
}{
"error": "Unprocessable Entity",
"errors": {}
}Authorizations
Personal API token — find yours under My Account → API.
Headers
Your own identification of the user on whose behalf the request is made, any string. The user identifiers should not be guessable and stay secret, otherwise users could get access to other users' contents. Only used with a public API token: the created or changed object belongs to that anonymous user instead of the token owner, which keeps the user in control of it in later requests with the same identifier.
Access password of the poll. Only needed for password protected polls.
Query Parameters
public_id of an organization the user belongs to. When given, the request runs in that organization context instead of the personal account.
Body
Show child attributes
Show child attributes
Response
vote updated
A vote of one participant for one option. Which value field is set depends on the poll's vote_type.
Vote id
"Votes::RatingVote"
Option public_id. For pairwise comparisons the option that won the comparison.
Pairwise comparisons only: option public_id of the option that lost the comparison.
Voter public_id
The value of the vote, whichever of vote, vote_date, vote_text or the decimal value is set.
Day the vote was cast on, for polls with vote_per_day.
Value of text votes, e.g. table columns.
Admin access only, and only for polls with a voting wallet. false while bought votes are not paid yet.
Only for polls with voting_categories.