Poll Lookup
Endpoints:
- Get a poll
- Get multiple polls
- Get the authenticated user's polls
- Get responses to the authenticated user's polls
GET /polls/{poll_id}
Token:
Scope:
Retrieve a poll object.
URL Parameters
Name | Description |
---|---|
poll_id |
ID of the requested poll |
Query Parameters
Name | Description |
---|---|
poll_token |
Required on private polls when you don't know or aren't guaranteed access |
Example
curl "https://api.pnut.io/v1/polls/1" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "X-Pretty-Json: 1"
Returns the requested poll details
{
"meta": {
"code": 200
},
"data": {"...Poll Object..."}
}
GET /polls
Token:
Scope:
Retrieve a list of specified poll objects. Only returns the first 100 found.
If the polls need a poll_token
to access, you may include them with query parameters in the pattern ?poll_token_{poll_id}=xxx&poll_token_{poll_id}=xxx
.
Query String Parameters
Name | Description |
---|---|
ids |
Comma-separated list of poll IDs |
Example
curl "https://api.pnut.io/v1/polls?ids=1,12" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "X-Pretty-Json: 1"
Returns a list of polls
{
"meta": {
"code": 200
},
"data": [
{"...Poll Object..."},
{"...Poll Object..."}
]
}
GET /users/me/polls
Token:
Scope:
Retrieve a list of polls created by the authenticated user.
Example
curl "https://api.pnut.io/v1/users/me/polls" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "X-Pretty-Json: 1"
Returns a list of polls
{
"meta": {
"more": false,
"code": 200,
"min_id": "0",
"max_id": "0"
},
"data": [
{"...Poll Object..."},
{"...Poll Object..."}
]
}
GET /users/me/polls/responses
Token:
Scope:
Retrieve a list of responses to polls created by the authenticated user. This is a parallel to the poll_response
user interaction.
Query String Parameters
Name | Description |
---|---|
ids |
Optional comma-separated list of poll IDs. If included, only poll responses to these polls will be returned |
Example
curl "https://api.pnut.io/v1/users/me/polls/responses" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "X-Pretty-Json: 1"
Returns a list of polls
{
"meta": {
"more": false,
"code": 200,
"min_id": "0",
"max_id": "0"
},
"data": [
{"...Abbreviated Poll Object..."},
{"...Abbreviated Poll Object..."}
]
}