Create Vote

Add a vote to an option

Now that you have a Poll with some options, let's go ahead and add vote to it.

post
Add vote to an option in a poll

https://api.pollsapi.com/v1/create/vote
This endpoint helps you add a vote to an option
Request
Response
Request
Headers
Content-Type
required
string
application/json
api-key
required
string
API Key for your account
Body Parameters
poll_id
required
string
ID of the Poll on which the vote will be added
option_id
required
string
ID of the Option the vote will be on
identifier
optional
string
Custom field that can be used to store some identifier
Response
200: OK
Poll Created
{
"status": "success",
"statusCode": 200,
"data": {
"identifier": "user_12",
"poll_id": "5f9f7b186477891e5bc646a1",
"option_id": "5f9f7b186477891e5bc646a2",
"created_at": "2020-11-02T06:24:24.760Z",
"updated_at": "2020-11-02T06:24:24.760Z",
"id": "5f9fa6186477891e5bc646a5",
"entity": "Vote"
}
}

Example cURL Request

curl -X POST https://api.pollsapi.com/v1/create/vote \
-H "content-type: application/json" \
-H "api-key: $API_KEY" \
-d '
{
"poll_id": "5f9f7b186477891e5bc646a1",
"option_id": "5f9f7b186477891e5bc646a2",
"identifier": "user_12"
}
'

Request Body

{
"poll_id": "5f9f7b186477891e5bc646a1",
"option_id": "5f9f7b186477891e5bc646a2",
"identifier": "user_12"
}