Skip to main contentIBM Video Streaming Developers

Poll

Get a list of Polls on a Channel

Returns the Polls on a channel

GET https://api.video.ibm.com/channels/{channelId}/polls.json

Parameters

The query parameters for the GET request:

PARAMETERTYPEIMPORTANCEDESCRIPTION
pageintegerOPTIONALRequested page number (value is 1 by default)
pagesizeintegerOPTIONALRequested page size (value is 20 by default, max. 20)

Success response

Upon success a response with HTTP status “200 OK” is returned with the following key-value pairs under an polls key.

KEYTYPEDESCRIPTION
poll_idintegerPoll ID
questionstringQuestion
votesintegerVote count
created_atintegerThe date and time when the Poll was created (Unix timestamp)

Example of a success response:

{
"polls": [
{
"poll_id": "john",
"question": "What is your favourite color?",
"votes": 3,
"created_at": 1599852837
},
...

The paging information can be found under the paging key. Example:

{
"paging": {
"previous": "https://api.video.ibm.com/channels/CHANNEL_ID/polls.json?page=1",
"next": "https://api.video.ibm.com/channels/CHANNEL_ID/polls.json?page=3",
"page_count": 3,
"item_count": 272
}
}

Error responses

Possible error responses:

HTTP RESPONSE CODEERROR VALUEERROR CONDITIONS
401 Unauthorizedinvalid_tokenThe provided access token is missing, revoked, expired or malformed
403 Unauthorizedlack_of_ownershipThe provided access token could not access the given channel
503 Service UnavailableThere is a temporary error on the server which makes it impossible to serve the request

Get a list of available answers for a Poll on a Channel

Returns the available answers for a Poll

GET https://api.video.ibm.com/channels/{channelId}/polls/{pollId}/answers.json

Success response

Upon success a response with HTTP status “200 OK” is returned with the following key-value pairs under an answers key.

KEYTYPEDESCRIPTION
answer_idintegerAnswer ID
answerstringAnswer

Example of a success response:

{
"answers": [
{
"answer_id": 34563,
"answer": "Blue"
},
...
]
}

Error responses

Possible error responses:

HTTP RESPONSE CODEERROR VALUEERROR CONDITIONS
401 Unauthorizedinvalid_tokenThe provided access token is missing, revoked, expired or malformed
403 Unauthorizedlack_of_ownershipThe provided access token could not access the given channel
404 Unauthorizednot_foundPoll not found
503 Service UnavailableThere is a temporary error on the server which makes it impossible to serve the request

Get a list of Votes for a Poll on a Channel

Returns the Viewers’ Votes for a Poll

GET https://api.video.ibm.com/channels/{channelId}/polls/{pollId}/votes.json

Parameters

The query parameters for the GET request:

PARAMETERTYPEIMPORTANCEDESCRIPTION
pageintegerOPTIONALRequested page number (value is 1 by default)
pagesizeintegerOPTIONALRequested page size (value is 100 by default, max. 100)

Success response

Upon success a response with HTTP status “200 OK” is returned with the following key-value pairs under an votes key.

KEYTYPEDESCRIPTION
user_idstringUser ID
answer_idintegerAnswer ID
answered_atintegerThe date and time when the Vote was created (Unix timestamp)

Example of a success response:

{
"polls": [
{
"user_id": "john@example.com",
"answer_id": 34563,
"answered_at": 1599852837
},
...
]

The paging information can be found under the paging key. Example:

{
"paging": {
"previous": "https://api.video.ibm.com/channels/CHANNEL_ID/polls/POLL_ID/votes.json?page=1",
"next": "https://api.video.ibm.com/channels/CHANNEL_ID/polls/POLL_ID/votes.json?page=3",
"page_count": 3,
"item_count": 272
}
}

Error responses

Possible error responses:

HTTP RESPONSE CODEERROR VALUEERROR CONDITIONS
401 Unauthorizedinvalid_tokenThe provided access token is missing, revoked, expired or malformed
403 Unauthorizedlack_of_ownershipThe provided access token could not access the given channel
404 Unauthorizednot_foundPoll not found
503 Service UnavailableThere is a temporary error on the server which makes it impossible to serve the request