PowerBuilder / Zoom API / Create a webinar's poll
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Name
string ls_V_type
integer li_Answer_required
integer j
integer li_Count_j
string ls_StrVal
string ls_Id
string ls_Status
string ls_Title
integer li_Anonymous
integer li_Poll_type
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
// Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_Req.HttpVerb = "POST"
loo_Req.Path = "/v2/webinars/:webinarId/polls"
loo_Req.ContentType = "multipart/form-data"
loo_Req.AddParam("title","a")
loo_Req.AddParam("poll_type","a3")
loo_Req.AddParam("anonymous","a3false")
loo_Req.AddParam("questions","a3false[{~"name~":~"ad in ullamco elit~",~"type~":~"rating_scale~",~"show_as_dropdown~":false,~"answer_required~":false,~"answers~":[~"in ~",~"do sint ipsum~"],~"right_answers~":[~"deserunt id~"],~"prompts~":[{~"prompt_question~":~"sint ipsum irure~",~"prompt_right_answers~":[~"sit officia~",~"irure est nostrud nul~"]},{~"prompt_question~":~"qui~",~"prompt_right_answers~":[~"veniam~",~"voluptate reprehenderit irure~"]}],~"answer_min_character~":29173071,~"answer_max_character~":27567154,~"case_sensitive~":false,~"rating_min_value~":58887175,~"rating_max_value~":-45787201,~"rating_min_label~":~"ea commodo~",~"rating_max_label~":~"ipsum dolore~"},{~"name~":~"ut eiusmod adipisicing exercitation~",~"type~":~"single~",~"show_as_dropdown~":false,~"answer_required~":false,~"answers~":[~"Excepteur Ut~",~"exercitation voluptate~"],~"right_answers~":[~"occaecat do esse~"],~"prompts~":[{~"prompt_question~":~"laboris eiusmod commodo ipsum ut~",~"prompt_right_answers~":[~"ut Lorem dolor do~",~"ullamco cillum tempor pariatur~"]},{~"prompt_question~":~"officia l~",~"prompt_right_answers~":[~"nulla pariatur~",~"voluptate aliqua sint~"]}],~"answer_min_character~":68878731,~"answer_max_character~":-60270992,~"case_sensitive~":false,~"rating_min_value~":61727066,~"rating_max_value~":-36610809,~"rating_min_label~":~"in ut~",~"rating_max_label~":~"proident officia~"}]")
loo_Req.AddHeader("Authorization","Bearer <access_token>")
loo_Resp = loo_Http.SynchronousRequest("api.zoom.us",443,1,loo_Req)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_Req
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "id": "cdjfhdsdfd",
// "status": "ended",
// "title": "Learn something new",
// "anonymous": false,
// "poll_type": 2,
// "questions": [
// {
// "name": "How are you?",
// "type": "multiple",
// "answer_required": false,
// "answers": [
// "Good",
// "Not so good"
// ],
// "right_answers": [
// "Good"
// ]
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Id = loo_JResp.StringOf("id")
ls_Status = loo_JResp.StringOf("status")
ls_Title = loo_JResp.StringOf("title")
li_Anonymous = loo_JResp.BoolOf("anonymous")
li_Poll_type = loo_JResp.IntOf("poll_type")
i = 0
li_Count_i = loo_JResp.SizeOfArray("questions")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("questions[i].name")
ls_V_type = loo_JResp.StringOf("questions[i].type")
li_Answer_required = loo_JResp.BoolOf("questions[i].answer_required")
j = 0
li_Count_j = loo_JResp.SizeOfArray("questions[i].answers")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("questions[i].answers[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("questions[i].right_answers")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("questions[i].right_answers[j]")
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_Req
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: multipart/form-data"
--form 'title=a'
--form 'poll_type=a3'
--form 'anonymous=a3false'
--form 'questions=a3false[{"name":"ad in ullamco elit","type":"rating_scale","show_as_dropdown":false,"answer_required":false,"answers":["in ","do sint ipsum"],"right_answers":["deserunt id"],"prompts":[{"prompt_question":"sint ipsum irure","prompt_right_answers":["sit officia","irure est nostrud nul"]},{"prompt_question":"qui","prompt_right_answers":["veniam","voluptate reprehenderit irure"]}],"answer_min_character":29173071,"answer_max_character":27567154,"case_sensitive":false,"rating_min_value":58887175,"rating_max_value":-45787201,"rating_min_label":"ea commodo","rating_max_label":"ipsum dolore"},{"name":"ut eiusmod adipisicing exercitation","type":"single","show_as_dropdown":false,"answer_required":false,"answers":["Excepteur Ut","exercitation voluptate"],"right_answers":["occaecat do esse"],"prompts":[{"prompt_question":"laboris eiusmod commodo ipsum ut","prompt_right_answers":["ut Lorem dolor do","ullamco cillum tempor pariatur"]},{"prompt_question":"officia l","prompt_right_answers":["nulla pariatur","voluptate aliqua sint"]}],"answer_min_character":68878731,"answer_max_character":-60270992,"case_sensitive":false,"rating_min_value":61727066,"rating_max_value":-36610809,"rating_min_label":"in ut","rating_max_label":"proident officia"}]'
https://api.zoom.us/v2/webinars/:webinarId/polls
Postman Collection Item JSON
{
"name": "Create a webinar's poll",
"request": {
"auth": {
"type": "oauth2"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "title",
"value": "a",
"description": "undefined",
"type": "text"
},
{
"key": "poll_type",
"value": "3",
"description": "undefined",
"type": "text"
},
{
"key": "anonymous",
"value": "false",
"description": "undefined",
"type": "text"
},
{
"key": "questions",
"value": "[{\"name\":\"ad in ullamco elit\",\"type\":\"rating_scale\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"in \",\"do sint ipsum\"],\"right_answers\":[\"deserunt id\"],\"prompts\":[{\"prompt_question\":\"sint ipsum irure\",\"prompt_right_answers\":[\"sit officia\",\"irure est nostrud nul\"]},{\"prompt_question\":\"qui\",\"prompt_right_answers\":[\"veniam\",\"voluptate reprehenderit irure\"]}],\"answer_min_character\":29173071,\"answer_max_character\":27567154,\"case_sensitive\":false,\"rating_min_value\":58887175,\"rating_max_value\":-45787201,\"rating_min_label\":\"ea commodo\",\"rating_max_label\":\"ipsum dolore\"},{\"name\":\"ut eiusmod adipisicing exercitation\",\"type\":\"single\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"Excepteur Ut\",\"exercitation voluptate\"],\"right_answers\":[\"occaecat do esse\"],\"prompts\":[{\"prompt_question\":\"laboris eiusmod commodo ipsum ut\",\"prompt_right_answers\":[\"ut Lorem dolor do\",\"ullamco cillum tempor pariatur\"]},{\"prompt_question\":\"officia l\",\"prompt_right_answers\":[\"nulla pariatur\",\"voluptate aliqua sint\"]}],\"answer_min_character\":68878731,\"answer_max_character\":-60270992,\"case_sensitive\":false,\"rating_min_value\":61727066,\"rating_max_value\":-36610809,\"rating_min_label\":\"in ut\",\"rating_max_label\":\"proident officia\"}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"polls"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
},
"description": "Create a [poll](https://support.zoom.us/hc/en-us/articles/203749865-Polling-for-Webinars) for a webinar.<br><br>\n**Scopes:** `webinar:write:admin` `webinar:write`<br>\n \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`<br>\n\n"
},
"response": [
{
"name": "**HTTP Status Code:** `201`<br>\nWebinar Poll Created",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "title",
"value": "fugiat exercitation proident magna ullamco",
"description": "undefined",
"type": "text"
},
{
"key": "poll_type",
"value": "1",
"description": "undefined",
"type": "text"
},
{
"key": "anonymous",
"value": "false",
"description": "undefined",
"type": "text"
},
{
"key": "questions",
"value": "[{\"name\":\"irure ex velit consectetur\",\"type\":\"rating_scale\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"commodo in in ad\",\"do officia dolore eu\"],\"right_answers\":[\"laborum officia\"],\"prompts\":[{\"prompt_question\":\"minim in mollit\",\"prompt_right_answers\":[\"in cillum amet\",\"cupida\"]},{\"prompt_question\":\"eiusmod culpa\",\"prompt_right_answers\":[\"irure fugiat\",\"eiusmod et occaecat magna sed\"]}],\"answer_min_character\":93145901,\"answer_max_character\":91006906,\"case_sensitive\":false,\"rating_min_value\":37530130,\"rating_max_value\":-38740448,\"rating_min_label\":\"quis non proident Duis\",\"rating_max_label\":\"irure pariatur nisi\"},{\"name\":\"labore cillum\",\"type\":\"rank_order\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"in aliqua cillum\",\"irure fugiat qui et\"],\"right_answers\":[\"dolor in u\"],\"prompts\":[{\"prompt_question\":\"occaecat reprehenderit\",\"prompt_right_answers\":[\"reprehenderit deserunt\",\"c\"]},{\"prompt_question\":\"occaecat velit\",\"prompt_right_answers\":[\"ut mollit eu ipsum\",\"qui et tempor aute\"]}],\"answer_min_character\":72197843,\"answer_max_character\":-2000739,\"case_sensitive\":false,\"rating_min_value\":25766114,\"rating_max_value\":-12152537,\"rating_min_label\":\"adipisicing mollit in et\",\"rating_max_label\":\"Lorem magna non id\"}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"polls"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Location",
"value": "quis officia in reprehenderit",
"description": "Location of created Webinar Poll"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": \"cdjfhdsdfd\",\n \"status\": \"ended\",\n \"title\": \"Learn something new\",\n \"anonymous\": false,\n \"poll_type\": 2,\n \"questions\": [\n {\n \"name\": \"How are you?\",\n \"type\": \"multiple\",\n \"answer_required\": false,\n \"answers\": [\n \"Good\",\n \"Not so good\"\n ],\n \"right_answers\": [\n \"Good\"\n ]\n }\n ]\n}"
},
{
"name": "**HTTP Status Code:** `300`<br>Invalid webinarId.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "title",
"value": "fugiat exercitation proident magna ullamco",
"description": "undefined",
"type": "text"
},
{
"key": "poll_type",
"value": "1",
"description": "undefined",
"type": "text"
},
{
"key": "anonymous",
"value": "false",
"description": "undefined",
"type": "text"
},
{
"key": "questions",
"value": "[{\"name\":\"irure ex velit consectetur\",\"type\":\"rating_scale\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"commodo in in ad\",\"do officia dolore eu\"],\"right_answers\":[\"laborum officia\"],\"prompts\":[{\"prompt_question\":\"minim in mollit\",\"prompt_right_answers\":[\"in cillum amet\",\"cupida\"]},{\"prompt_question\":\"eiusmod culpa\",\"prompt_right_answers\":[\"irure fugiat\",\"eiusmod et occaecat magna sed\"]}],\"answer_min_character\":93145901,\"answer_max_character\":91006906,\"case_sensitive\":false,\"rating_min_value\":37530130,\"rating_max_value\":-38740448,\"rating_min_label\":\"quis non proident Duis\",\"rating_max_label\":\"irure pariatur nisi\"},{\"name\":\"labore cillum\",\"type\":\"rank_order\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"in aliqua cillum\",\"irure fugiat qui et\"],\"right_answers\":[\"dolor in u\"],\"prompts\":[{\"prompt_question\":\"occaecat reprehenderit\",\"prompt_right_answers\":[\"reprehenderit deserunt\",\"c\"]},{\"prompt_question\":\"occaecat velit\",\"prompt_right_answers\":[\"ut mollit eu ipsum\",\"qui et tempor aute\"]}],\"answer_min_character\":72197843,\"answer_max_character\":-2000739,\"case_sensitive\":false,\"rating_min_value\":25766114,\"rating_max_value\":-12152537,\"rating_min_label\":\"adipisicing mollit in et\",\"rating_max_label\":\"Lorem magna non id\"}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"polls"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "Multiple Choices",
"code": 300,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `400` **Bad Request** <br>\n **Error Code:** `4400` <br>\n* Webinar polls disabled. To enable this feature, enable the \"Webinar Polls/Quizzes\" setting in the Zoom web portal's \"Settings\" interface. \n* Advanced webinar polls disabled. T",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "title",
"value": "fugiat exercitation proident magna ullamco",
"description": "undefined",
"type": "text"
},
{
"key": "poll_type",
"value": "1",
"description": "undefined",
"type": "text"
},
{
"key": "anonymous",
"value": "false",
"description": "undefined",
"type": "text"
},
{
"key": "questions",
"value": "[{\"name\":\"irure ex velit consectetur\",\"type\":\"rating_scale\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"commodo in in ad\",\"do officia dolore eu\"],\"right_answers\":[\"laborum officia\"],\"prompts\":[{\"prompt_question\":\"minim in mollit\",\"prompt_right_answers\":[\"in cillum amet\",\"cupida\"]},{\"prompt_question\":\"eiusmod culpa\",\"prompt_right_answers\":[\"irure fugiat\",\"eiusmod et occaecat magna sed\"]}],\"answer_min_character\":93145901,\"answer_max_character\":91006906,\"case_sensitive\":false,\"rating_min_value\":37530130,\"rating_max_value\":-38740448,\"rating_min_label\":\"quis non proident Duis\",\"rating_max_label\":\"irure pariatur nisi\"},{\"name\":\"labore cillum\",\"type\":\"rank_order\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"in aliqua cillum\",\"irure fugiat qui et\"],\"right_answers\":[\"dolor in u\"],\"prompts\":[{\"prompt_question\":\"occaecat reprehenderit\",\"prompt_right_answers\":[\"reprehenderit deserunt\",\"c\"]},{\"prompt_question\":\"occaecat velit\",\"prompt_right_answers\":[\"ut mollit eu ipsum\",\"qui et tempor aute\"]}],\"answer_min_character\":72197843,\"answer_max_character\":-2000739,\"case_sensitive\":false,\"rating_min_value\":25766114,\"rating_max_value\":-12152537,\"rating_min_label\":\"adipisicing mollit in et\",\"rating_max_label\":\"Lorem magna non id\"}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"polls"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `404`<br>\nWebinar not found.<br>",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "title",
"value": "fugiat exercitation proident magna ullamco",
"description": "undefined",
"type": "text"
},
{
"key": "poll_type",
"value": "1",
"description": "undefined",
"type": "text"
},
{
"key": "anonymous",
"value": "false",
"description": "undefined",
"type": "text"
},
{
"key": "questions",
"value": "[{\"name\":\"irure ex velit consectetur\",\"type\":\"rating_scale\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"commodo in in ad\",\"do officia dolore eu\"],\"right_answers\":[\"laborum officia\"],\"prompts\":[{\"prompt_question\":\"minim in mollit\",\"prompt_right_answers\":[\"in cillum amet\",\"cupida\"]},{\"prompt_question\":\"eiusmod culpa\",\"prompt_right_answers\":[\"irure fugiat\",\"eiusmod et occaecat magna sed\"]}],\"answer_min_character\":93145901,\"answer_max_character\":91006906,\"case_sensitive\":false,\"rating_min_value\":37530130,\"rating_max_value\":-38740448,\"rating_min_label\":\"quis non proident Duis\",\"rating_max_label\":\"irure pariatur nisi\"},{\"name\":\"labore cillum\",\"type\":\"rank_order\",\"show_as_dropdown\":false,\"answer_required\":false,\"answers\":[\"in aliqua cillum\",\"irure fugiat qui et\"],\"right_answers\":[\"dolor in u\"],\"prompts\":[{\"prompt_question\":\"occaecat reprehenderit\",\"prompt_right_answers\":[\"reprehenderit deserunt\",\"c\"]},{\"prompt_question\":\"occaecat velit\",\"prompt_right_answers\":[\"ut mollit eu ipsum\",\"qui et tempor aute\"]}],\"answer_min_character\":72197843,\"answer_max_character\":-2000739,\"case_sensitive\":false,\"rating_min_value\":25766114,\"rating_max_value\":-12152537,\"rating_min_label\":\"adipisicing mollit in et\",\"rating_max_label\":\"Lorem magna non id\"}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"polls"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}