Create/Update polls

Create polls

This endpoint is used to create polls. Using this polls can be created that can be later linked to rooms for autostart or start by sdk.

A recommended way to create a poll is to provide a list of questions while creating poll, then update those questions by modifying them using update question/delete question or update/delete options API.

POSThttps://api.100ms.live/v2/polls
curl --location --request POST 'https://api.100ms.live/v2/polls' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "first poll", "duration": 235, "anonymous": true, "mode": "userid", "type": "poll", "start": "auto", "questions": [ { "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }, { "index": 2, "text": "q2", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 1, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] } ] }'
RESPONSE
Status: 200 OK
{ "id": "655bffeecd34739a72637305", "title": "first poll", "duration": 235, "anonymous": true, "mode": "userid", "type": "poll", "start": "auto", "questions": [ { "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }, { "index": 2, "text": "q2", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 1, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] } ] }

Update polls

This endpoint is used to update polls. Given poll will be rewritten with new information.

POSThttps://api.100ms.live/v2/polls/<poll_id>
curl --location --request POST 'https://api.100ms.live/v2/polls/655bffeecd34739a72637305' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "first poll", "duration": 235, "anonymous": true, "mode": "userid", "type": "poll", "start": "auto", "questions": [ { "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }, { "index": 2, "text": "q2", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 1, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] } ] }'
RESPONSE
Status: 200 OK
{ "id": " "title": "first poll", "duration": 235, "anonymous": true, "mode": "userid", "type": "poll", "start": "auto", "questions": [ { "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }, { "index": 2, "text": "q2", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 1, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] } ] }

Path parameters

NameDescription
poll_id
poll id

Update polls question

This endpoint is used to update polls question via API. Given question_id will be rewritten using new information.

POSThttps://api.100ms.live/v2/polls/<poll_id>/questions/<question_id>
curl --location --request POST 'https://api.100ms.live/v2/polls/655bffeecd34739a72637305/questions/1' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }'
RESPONSE
Status: 200 OK
{ "index": 1, "text": "q1", "format": "text", "attachment": [ { "type": "mimetype", "url": "url" } ], "skippable": true, "duration": 0, "once": false, "weight": 2, "answer_min_len": 1, "answer_max_len": 1024, "type": "single-choice", "answer": { "hidden": false, "options": [ 1, 2 ], "text": "optoin1", "case": false, "trim": true }, "options": [ { "index": 1, "text": "optoin1", "weight": 1 }, { "index": 2, "text": "optoin1", "weight": 1 } ] }'

Path parameters

NameDescription
poll_id
poll id
question_id
question_id starting from 1

Update polls option

This endpoint is used to update polls option via API. Given option_id will be rewritten with new infromation.

POSThttps://api.100ms.live/v2/polls/<poll_id>/questions/<question_id>/options/<option_id>
curl --location --request POST 'https://api.100ms.live/v2/polls/655bffeecd34739a72637305/questions/1/options/1' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "index": 1, "text": "option1", "weight": 1 }'
RESPONSE
Status: 200 OK
{ "index": 1, "text": "option1", "weight": 1 }

Path parameters

NameDescription
poll_id
poll id
question_id
question_id starting from 1
option_id
option_id starting from 1

Delete polls question

This endpoint is used to delete polls question. This option can be used if you know which question indexes to delete. Other questions are re-indexed when the given question is deleted i.e. larger indexes are pushed one index backwards.

DELETEhttps://api.100ms.live/v2/polls/<poll_id>/questions/<question_id>
curl --location --request DELETE 'https://api.100ms.live/v2/polls/655bffeecd34739a72637305/questions/1' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json'
RESPONSE
Status: 204 No Content

Path parameters

NameDescription
poll_id
poll id
question_id
question_id starting from 1

Delete polls option

This endpoint is used to delete polls option. This option can be used if you know which option indexes to delete. Other options are re-indexed when the given option is deleted i.e. larger indexes are pushed one index backwards.

DELETEhttps://api.100ms.live/v2/polls/<poll_id>/questions/<question_id>/options/<option_id>
curl --location --request DELETE 'https://api.100ms.live/v2/polls/655bffeecd34739a72637305/questions/1/options/1' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json'
RESPONSE
Status: 204 No Content

Path parameters

NameDescription
poll_id
poll id
question_id
question_id starting from 1
option_id
option_id starting from 1

Have a suggestion? Recommend changes ->

Run in postman

Was this helpful?

1234