SQL Server / Zoom API / List past meeting's poll results
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.zoom.us/v2/past_meetings/:meetingId/polls', @sbResponseBody
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "id": 123456,
-- "uuid": "gsdjfhsdfkhjdsf",
-- "start_time": "2019-02-01T12:34:12.660Z",
-- "title": "Learn something new",
-- "questions": [
-- {
-- "name": "Sam S",
-- "email": "example@example.com",
-- "question_details": [
-- {
-- "question": "How are you?",
-- "answer": "I am wonderful."
-- }
-- ]
-- }
-- ]
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @name nvarchar(4000)
DECLARE @email nvarchar(4000)
DECLARE @j int
DECLARE @count_j int
DECLARE @question nvarchar(4000)
DECLARE @answer nvarchar(4000)
DECLARE @id int
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'id'
DECLARE @uuid nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @uuid OUT, 'uuid'
DECLARE @start_time nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @start_time OUT, 'start_time'
DECLARE @title nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @title OUT, 'title'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'questions'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'questions[i].name'
EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'questions[i].email'
SELECT @j = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'questions[i].question_details'
WHILE @j < @count_j
BEGIN
EXEC sp_OASetProperty @jResp, 'J', @j
EXEC sp_OAMethod @jResp, 'StringOf', @question OUT, 'questions[i].question_details[j].question'
EXEC sp_OAMethod @jResp, 'StringOf', @answer OUT, 'questions[i].question_details[j].answer'
SELECT @j = @j + 1
END
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/past_meetings/:meetingId/polls
Postman Collection Item JSON
{
"name": "List past meeting's poll results",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/past_meetings/:meetingId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"past_meetings",
":meetingId",
"polls"
],
"variable": [
{
"key": "meetingId",
"value": "quis officia in reprehenderit",
"description": "(Required) The meeting's ID or universally unique ID (UUID). \n* If you provide a meeting ID, the API will return a response for the latest meeting instance. \n* If you provide a meeting UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the meeting UUID before making an API request."
}
]
},
"description": "[Polls](https://support.zoom.us/hc/en-us/articles/213756303-Polling-for-Meetings) allow the meeting host to survey attendees. Use this API to list poll results of a meeting.<br><br>\n\n**Scopes**: `meeting:read:admin`, `meeting:read`<br>\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium` <br>\n**Prerequisites**:<br>\n* Host user type must be **Pro**.\n* Meeting must be a scheduled meeting. Instant meetings do not have polling features enabled."
},
"response": [
{
"name": "**HTTP Status Code:** `200` **OK**<br>\nPolls returned successfully.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/past_meetings/:meetingId/polls",
"host": [
"{{baseUrl}}"
],
"path": [
"past_meetings",
":meetingId",
"polls"
],
"variable": [
{
"key": "meetingId",
"value": "quis officia in reprehenderit",
"description": "(Required) The meeting's ID or universally unique ID (UUID). \n* If you provide a meeting ID, the API will return a response for the latest meeting instance. \n* If you provide a meeting UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the meeting UUID before making an API request."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": 123456,\n \"uuid\": \"gsdjfhsdfkhjdsf\",\n \"start_time\": \"2019-02-01T12:34:12.660Z\",\n \"title\": \"Learn something new\",\n \"questions\": [\n {\n \"name\": \"Sam S\",\n \"email\": \"example@example.com\",\n \"question_details\": [\n {\n \"question\": \"How are you?\",\n \"answer\": \"I am wonderful.\"\n }\n ]\n }\n ]\n}"
}
]
}