curl --request PATCH \
--url https://pollunit.com/api/v1/polls/{poll_id}/voters/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"voter": {
"user_name": "<string>",
"additional_attributes": {},
"terms_accepted": true,
"privacy_policy_accepted": true
}
}
'import requests
url = "https://pollunit.com/api/v1/polls/{poll_id}/voters/{id}"
payload = { "voter": {
"user_name": "<string>",
"additional_attributes": {},
"terms_accepted": True,
"privacy_policy_accepted": True
} }
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({
voter: {
user_name: '<string>',
additional_attributes: {},
terms_accepted: true,
privacy_policy_accepted: true
}
})
};
fetch('https://pollunit.com/api/v1/polls/{poll_id}/voters/{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}/voters/{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([
'voter' => [
'user_name' => '<string>',
'additional_attributes' => [
],
'terms_accepted' => true,
'privacy_policy_accepted' => true
]
]),
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}/voters/{id}"
payload := strings.NewReader("{\n \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\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}/voters/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pollunit.com/api/v1/polls/{poll_id}/voters/{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 \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"user_name": "<string>",
"changed_by_admin": true,
"complete": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"fraudulent": true,
"paid": true,
"required_option_votes_complete": true,
"privacy_policy_accepted": true,
"terms_accepted": true
}{
"error": "Unauthorized"
}{
"error": "Not Found"
}{
"error": "Unprocessable Entity",
"errors": {}
}Update participant
Changes an existing participant. Only the given attributes are written, the others keep their value. The participant has to belong to the requesting user — identified by the private token or, for anonymous users, by the X-POLLUNIT-USER-IDENTIFIER header — and the poll has to still accept votes. Admins may additionally change other participants of voting and table polls that do not anonymize or hide their participants.
curl --request PATCH \
--url https://pollunit.com/api/v1/polls/{poll_id}/voters/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"voter": {
"user_name": "<string>",
"additional_attributes": {},
"terms_accepted": true,
"privacy_policy_accepted": true
}
}
'import requests
url = "https://pollunit.com/api/v1/polls/{poll_id}/voters/{id}"
payload = { "voter": {
"user_name": "<string>",
"additional_attributes": {},
"terms_accepted": True,
"privacy_policy_accepted": True
} }
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({
voter: {
user_name: '<string>',
additional_attributes: {},
terms_accepted: true,
privacy_policy_accepted: true
}
})
};
fetch('https://pollunit.com/api/v1/polls/{poll_id}/voters/{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}/voters/{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([
'voter' => [
'user_name' => '<string>',
'additional_attributes' => [
],
'terms_accepted' => true,
'privacy_policy_accepted' => true
]
]),
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}/voters/{id}"
payload := strings.NewReader("{\n \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\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}/voters/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pollunit.com/api/v1/polls/{poll_id}/voters/{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 \"voter\": {\n \"user_name\": \"<string>\",\n \"additional_attributes\": {},\n \"terms_accepted\": true,\n \"privacy_policy_accepted\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"user_name": "<string>",
"changed_by_admin": true,
"complete": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"fraudulent": true,
"paid": true,
"required_option_votes_complete": true,
"privacy_policy_accepted": true,
"terms_accepted": true
}{
"error": "Unauthorized"
}{
"error": "Not Found"
}{
"error": "Unprocessable Entity",
"errors": {}
}Authorizations
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.
Query Parameters
Body
Response
participant updated
A participant of the poll. Which fields are returned depends on the poll type and on your access level: complete only for surveys, required_option_votes_complete only when the poll requires votes on all options or all dots, and moderation fields only with admin access.