Create Vote
curl --request POST \
--url https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": "<string>"
}
'import requests
url = "https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote"
payload = { "userId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '<string>'})
};
fetch('https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote', 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://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote",
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([
'userId' => '<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://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote"
payload := strings.NewReader("{\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyVotes
Create Vote
Create a vote for a specific suggestion
POST
/
api
/
v1
/
sdk
/
suggestions
/
{id}
/
vote
Create Vote
curl --request POST \
--url https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userId": "<string>"
}
'import requests
url = "https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote"
payload = { "userId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: '<string>'})
};
fetch('https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote', 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://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote",
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([
'userId' => '<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://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote"
payload := strings.NewReader("{\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://2d89d8691199.ngrok-free.app/api/v1/sdk/suggestions/{id}/vote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreate a vote for a specific suggestion. This allows users to upvote feature requests and show support for specific suggestions.
string
required
ID of the suggestion to vote for (CUID format, e.g., clm7x1a2b000008l7h3k1b2c3)
string
required
ID of the user creating the vote
Response Fields
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Unique vote identifier (auto-generated) |
| suggestionId | string | Yes | ID of the suggestion voted for |
| userId | string | Yes | ID of the user who voted |
| createdAt | string | Yes | Vote creation timestamp (ISO 8601) |
| updatedAt | string | Yes | Last update timestamp (ISO 8601) |
Example Request
{
"userId": "clm7x1a2b000008l7h3k1b2c3"
}
Example Response
{
"id": "clm7x1a2b000008l7h3k1b2c3",
"suggestionId": "clm7x1a2b000008l7h3k1b2c3",
"userId": "clm7x1a2b000008l7h3k1b2c3",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
Validation Rules
- One vote per user per suggestion: Users cannot vote multiple times on the same suggestion
- Valid IDs: userId must exist in the project
- Active records: Cannot vote on deleted suggestions or users
Error Responses
| Status Code | Description | Example Response |
|---|---|---|
| 400 | User already voted or missing data | {"error": "User has already voted on this suggestion"} |
| 401 | Unauthorized - Invalid API key | {"error": "Unauthorized"} |
| 404 | Suggestion or user not found | {"error": "Suggestion not found"} |
| 500 | Internal server error | {"error": "Failed to create vote"} |
Was this page helpful?
⌘I