Polls API
  • Polls API Documentation
  • API Introduction
  • API
    • Create poll
    • Get poll by Id
    • Get all polls
    • Get polls by identifer
    • Create Vote
    • Get Vote by Id
    • Get all votes on a poll
    • Get all votes with identifier
    • Remove vote
    • Remove Poll
Powered by GitBook
On this page
  • Get Poll by Id
  • Example cURL Request

Was this helpful?

  1. API

Get poll by Id

Endpoint to fetch a Poll by Id

PreviousCreate pollNextGet all polls

Last updated 4 years ago

Was this helpful?

You have a poll created, but how do you fetch it?

Well, this is the reason this endpoint exists. Just pass in the poll id that you want to retrieve and let the magic happen.

Get Poll by Id

GET https://api.pollsapi.com/v1/get/poll/{poll_id}

This endpoint allows you to fetch your poll by ID

Path Parameters

Name
Type
Description

poll_id

string

ID of the Poll to fetch

Headers

Name
Type
Description

api-key

string

API KEY for your account

{
  "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"
      }
    ]
  }
}
{ 
    "status": "error", 
    "statusCode": 404, 
    "message": "Poll not found" 
}

Example cURL Request

curl https://api.pollsapi.com/v1/get/poll/5f9f7b186477891e5bc646a1 \
  -H "content-type: application/json" \
  -H "api-key: $API_KEY"
😉