Create poll

API to create a poll

Fields Information

Poll

Key

Type

Description

question required

string

The question/title of the Poll

identifier

string

Can be used to pass in custom identifier, eg - user id, email, etc.

data

object

A flexible data field to store any meta data with each option

Option

Minimum 2 Options are required in a poll (Just making the obvious known 😅 )

Key

Type

Description

text required

string

String to store the option's text

data

object

A flexible data field to store any meta data with each option

post
Creating a Poll

https://api.pollsapi.com/v1/create/poll
This endpoint allows you to get free cakes.
Request
Response
Request
Headers
Content-Type
required
string
application/json
api-key
required
string
API Key for your account
Body Parameters
identifier
optional
string
Can be used to store a custom identifier
data
optional
object
A flexible data field to store custom metadata
question
required
string
The question/title of the poll you are creating
options
required
array
List of options the poll should have(Min. 2). Please check below for the structure of Option
Response
200: OK
Poll Created
{
"status": "success",
"statusCode": 200,
"data": {
"identifier": null,
"question": "Do you like polls?",
"data": {},
"created_at": "2020-10-24T02:28:46.391Z",
"updated_at": "2020-10-24T02:28:46.391Z",
"id": "5f93915e7e044c74074f072e",
"entity": "Poll",
"options": [
{
"text": "Yes",
"votes_count": 0,
"data": {},
"poll_id": "5f93915e7e044c74074f072e",
"created_at": "2020-10-24T02:28:46.422Z",
"updated_at": "2020-10-24T02:28:46.422Z",
"id": "5f93915e7e044c74074f072f",
"entity": "Option"
},
{
"text": "No",
"votes_count": 0,
"data": {},
"poll_id": "5f93915e7e044c74074f072e",
"created_at": "2020-10-24T02:28:46.422Z",
"updated_at": "2020-10-24T02:28:46.422Z",
"id": "5f93915e7e044c74074f0730",
"entity": "Option"
}
]
}
}

Example cURL request

curl -X POST \
'https://api.pollsapi.com/v1/create/poll' \
-H 'content-type: application/json' \
-H "api-key: $API_KEY" \
-d '
{
"question": "Do you like polls?",
"options": [
{
"text": "Yes"
},
{
"text": "No"
}
]
}
'

Request Body

{
"question": "Does this doc help?",
"identifier": "custom_identifier",
"data": {
"custom": "Poll Data"
}
"options": [
{
"text": "Option Text",
"data": {
"custom": "data"
}
},
{
"text": "Option Text2",
"data": {
"custom": "data"
}
}
]
}