Poll Lookup

Endpoints:

GET /polls/{poll_id}

Token: user

Scope: polls

Retrieve a poll object.

URL Parameters

Name Description
poll_id ID of the requested poll
Example
curl "https://api.pnut.io/v0/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: user

Scope: polls

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/v0/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: user

Scope: polls

Retrieve a list of polls created by the authenticated user.

Example
curl "https://api.pnut.io/v0/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: user

Scope: polls

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/v0/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..."}
    ]
}