SQL Server / Zoom API / Get webinar participants
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
DECLARE @iTmp0 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
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'type', 'live'
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'page_size', 30
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'next_page_token', 'quis officia in reprehenderit'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'include_fields', 'registrant_id'
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://api.zoom.us/v2/metrics/webinars/:webinarId/participants', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
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 @resp, 'GetBodySb', @success OUT, @sbResponseBody
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 @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "page_count": 1,
-- "page_size": 30,
-- "total_records": 1,
-- "next_page_token": "",
-- "participants": [
-- {
-- "id": "d52f19c548b88490b5d16fcbd38",
-- "user_id": "32dsfsd4g5gd",
-- "user_name": "dojo",
-- "device": "WIN",
-- "ip_address": "127.0.0.1",
-- "location": "New York",
-- "network_type": "Wired",
-- "microphone": "Plantronics BT600",
-- "camera": "FaceTime HD Camera",
-- "speaker": "Plantronics BT600",
-- "data_center": "SC",
-- "full_data_center": "United States;United States (US03_SC CRC)",
-- "connection_type": "P2P",
-- "join_time": "2019-09-07T13:15:02.837Z",
-- "leave_time": "2019-09-07T13:15:09.837Z",
-- "share_application": false,
-- "share_desktop": true,
-- "share_whiteboard": true,
-- "recording": false,
-- "status": "in_waiting_room",
-- "pc_name": "dojo's pc",
-- "domain": "Dojo-workspace",
-- "mac_addr": " 00:0a:95:9d:68:16",
-- "harddisk_id": "sed proident in",
-- "version": "4.4.55383.0716",
-- "leave_reason": "Dojo left the meeting.<br>Reason: Host ended the meeting.",
-- "sip_uri": "sip:sipp@10.100.112.140:11029",
-- "from_sip_uri": "sip:sipp@10.100.112.140:11029",
-- "role": "panelist"
-- }
-- ]
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @id nvarchar(4000)
DECLARE @user_id nvarchar(4000)
DECLARE @user_name nvarchar(4000)
DECLARE @device nvarchar(4000)
DECLARE @ip_address nvarchar(4000)
DECLARE @location nvarchar(4000)
DECLARE @network_type nvarchar(4000)
DECLARE @microphone nvarchar(4000)
DECLARE @camera nvarchar(4000)
DECLARE @speaker nvarchar(4000)
DECLARE @data_center nvarchar(4000)
DECLARE @full_data_center nvarchar(4000)
DECLARE @connection_type nvarchar(4000)
DECLARE @join_time nvarchar(4000)
DECLARE @leave_time nvarchar(4000)
DECLARE @share_application int
DECLARE @share_desktop int
DECLARE @share_whiteboard int
DECLARE @recording int
DECLARE @status nvarchar(4000)
DECLARE @pc_name nvarchar(4000)
DECLARE @domain nvarchar(4000)
DECLARE @mac_addr nvarchar(4000)
DECLARE @harddisk_id nvarchar(4000)
DECLARE @version nvarchar(4000)
DECLARE @leave_reason nvarchar(4000)
DECLARE @sip_uri nvarchar(4000)
DECLARE @from_sip_uri nvarchar(4000)
DECLARE @role nvarchar(4000)
DECLARE @page_count int
EXEC sp_OAMethod @jResp, 'IntOf', @page_count OUT, 'page_count'
DECLARE @page_size int
EXEC sp_OAMethod @jResp, 'IntOf', @page_size OUT, 'page_size'
DECLARE @total_records int
EXEC sp_OAMethod @jResp, 'IntOf', @total_records OUT, 'total_records'
DECLARE @next_page_token nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @next_page_token OUT, 'next_page_token'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'participants'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'participants[i].id'
EXEC sp_OAMethod @jResp, 'StringOf', @user_id OUT, 'participants[i].user_id'
EXEC sp_OAMethod @jResp, 'StringOf', @user_name OUT, 'participants[i].user_name'
EXEC sp_OAMethod @jResp, 'StringOf', @device OUT, 'participants[i].device'
EXEC sp_OAMethod @jResp, 'StringOf', @ip_address OUT, 'participants[i].ip_address'
EXEC sp_OAMethod @jResp, 'StringOf', @location OUT, 'participants[i].location'
EXEC sp_OAMethod @jResp, 'StringOf', @network_type OUT, 'participants[i].network_type'
EXEC sp_OAMethod @jResp, 'StringOf', @microphone OUT, 'participants[i].microphone'
EXEC sp_OAMethod @jResp, 'StringOf', @camera OUT, 'participants[i].camera'
EXEC sp_OAMethod @jResp, 'StringOf', @speaker OUT, 'participants[i].speaker'
EXEC sp_OAMethod @jResp, 'StringOf', @data_center OUT, 'participants[i].data_center'
EXEC sp_OAMethod @jResp, 'StringOf', @full_data_center OUT, 'participants[i].full_data_center'
EXEC sp_OAMethod @jResp, 'StringOf', @connection_type OUT, 'participants[i].connection_type'
EXEC sp_OAMethod @jResp, 'StringOf', @join_time OUT, 'participants[i].join_time'
EXEC sp_OAMethod @jResp, 'StringOf', @leave_time OUT, 'participants[i].leave_time'
EXEC sp_OAMethod @jResp, 'BoolOf', @share_application OUT, 'participants[i].share_application'
EXEC sp_OAMethod @jResp, 'BoolOf', @share_desktop OUT, 'participants[i].share_desktop'
EXEC sp_OAMethod @jResp, 'BoolOf', @share_whiteboard OUT, 'participants[i].share_whiteboard'
EXEC sp_OAMethod @jResp, 'BoolOf', @recording OUT, 'participants[i].recording'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'participants[i].status'
EXEC sp_OAMethod @jResp, 'StringOf', @pc_name OUT, 'participants[i].pc_name'
EXEC sp_OAMethod @jResp, 'StringOf', @domain OUT, 'participants[i].domain'
EXEC sp_OAMethod @jResp, 'StringOf', @mac_addr OUT, 'participants[i].mac_addr'
EXEC sp_OAMethod @jResp, 'StringOf', @harddisk_id OUT, 'participants[i].harddisk_id'
EXEC sp_OAMethod @jResp, 'StringOf', @version OUT, 'participants[i].version'
EXEC sp_OAMethod @jResp, 'StringOf', @leave_reason OUT, 'participants[i].leave_reason'
EXEC sp_OAMethod @jResp, 'StringOf', @sip_uri OUT, 'participants[i].sip_uri'
EXEC sp_OAMethod @jResp, 'StringOf', @from_sip_uri OUT, 'participants[i].from_sip_uri'
EXEC sp_OAMethod @jResp, 'StringOf', @role OUT, 'participants[i].role'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -G -d "type=live"
-d "page_size=30"
-d "next_page_token=quis%20officia%20in%20reprehenderit"
-d "include_fields=registrant_id"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/metrics/webinars/:webinarId/participants
Postman Collection Item JSON
{
"name": "Get webinar participants",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars",
":webinarId",
"participants"
],
"query": [
{
"key": "type",
"value": "live",
"description": "The type of webinar to query: \n* `past` — All past webinars. \n* `live` - All live webinars. \n\nThis value defaults to `live`."
},
{
"key": "page_size",
"value": "30",
"description": "The number of records returned within a single API call."
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit",
"description": "The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes."
},
{
"key": "include_fields",
"value": "registrant_id",
"description": "Additional fields to include in the query: \n* `registrant_id` — Include the webinar registrant's ID. The registrant ID is the [webinar registrant's unique ID](https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarregistrants)."
}
],
"variable": [
{
"key": "webinarId",
"value": "quis officia in reprehenderit",
"description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
}
]
},
"description": "Use this API to return information about participants from live or past webinars. \n\n**Note:** \n\nThis API may return empty values for participants' `user_name`, `ip_address`, `location`, and `email` responses when the account calling this API: \n* Does **not** have a signed HIPAA business associate agreement (BAA). \n* Is a [**legacy** HIPAA BAA account](https://marketplace.zoom.us/docs/api-reference/other-references/legacy-business-associate-agreements). \n\n**Scopes:** `dashboard_webinars:read:admin` <br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy` \n\n**Prerequisites:** \n* A Business, Education, or API Plan with Webinar add-on."
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nWebinar participants returned.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars",
":webinarId",
"participants"
],
"query": [
{
"key": "type",
"value": "live"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "registrant_id"
}
],
"variable": [
{
"key": "webinarId",
"value": "quis officia in reprehenderit",
"description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"page_count\": 1,\n \"page_size\": 30,\n \"total_records\": 1,\n \"next_page_token\": \"\",\n \"participants\": [\n {\n \"id\": \"d52f19c548b88490b5d16fcbd38\",\n \"user_id\": \"32dsfsd4g5gd\",\n \"user_name\": \"dojo\",\n \"device\": \"WIN\",\n \"ip_address\": \"127.0.0.1\",\n \"location\": \"New York\",\n \"network_type\": \"Wired\",\n \"microphone\": \"Plantronics BT600\",\n \"camera\": \"FaceTime HD Camera\",\n \"speaker\": \"Plantronics BT600\",\n \"data_center\": \"SC\",\n \"full_data_center\": \"United States;United States (US03_SC CRC)\",\n \"connection_type\": \"P2P\",\n \"join_time\": \"2019-09-07T13:15:02.837Z\",\n \"leave_time\": \"2019-09-07T13:15:09.837Z\",\n \"share_application\": false,\n \"share_desktop\": true,\n \"share_whiteboard\": true,\n \"recording\": false,\n \"status\": \"in_waiting_room\",\n \"pc_name\": \"dojo's pc\",\n \"domain\": \"Dojo-workspace\",\n \"mac_addr\": \" 00:0a:95:9d:68:16\",\n \"harddisk_id\": \"sed proident in\",\n \"version\": \"4.4.55383.0716\",\n \"leave_reason\": \"Dojo left the meeting.<br>Reason: Host ended the meeting.\",\n \"sip_uri\": \"sip:sipp@10.100.112.140:11029\",\n \"from_sip_uri\": \"sip:sipp@10.100.112.140:11029\",\n \"role\": \"panelist\"\n }\n ]\n}"
},
{
"name": "**Error Code:** `300`<br>\nCan not access webinar info, {webinarId}.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars",
":webinarId",
"participants"
],
"query": [
{
"key": "type",
"value": "live"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "registrant_id"
}
],
"variable": [
{
"key": "webinarId",
"value": "quis officia in reprehenderit",
"description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
}
]
}
},
"status": "Multiple Choices",
"code": 300,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `404`<br>\n**Error Code:** `3001`<br>\nThis webinar's detail info is not available or ID is not valid.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars",
":webinarId",
"participants"
],
"query": [
{
"key": "type",
"value": "live"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "registrant_id"
}
],
"variable": [
{
"key": "webinarId",
"value": "quis officia in reprehenderit",
"description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}