SQL Server / Zoom API / List meetings
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, 'UpdateString', @success OUT, 'from', '1989-05-07'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'to', '1989-05-07'
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', 'tracking_fields'
-- 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/meetings', @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)
-- {
-- "from": "string [date]",
-- "to": "string [date]",
-- "page_count": "integer",
-- "page_size": "integer",
-- "total_records": "integer",
-- "next_page_token": "string",
-- "meetings": [
-- {
-- "uuid": "string [uuid]",
-- "id": "integer",
-- "topic": "string",
-- "host": "string",
-- "email": "string",
-- "user_type": "string",
-- "start_time": "string [date-time]",
-- "end_time": "string [date-time]",
-- "duration": "string",
-- "participants": "integer",
-- "has_pstn": "boolean",
-- "has_voip": "boolean",
-- "has_3rd_party_audio": "boolean",
-- "has_video": "boolean",
-- "has_screen_share": "boolean",
-- "has_recording": "boolean",
-- "has_sip": "boolean",
-- "has_archiving": "boolean"
-- }
-- ]
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @uuid nvarchar(4000)
DECLARE @id nvarchar(4000)
DECLARE @topic nvarchar(4000)
DECLARE @host nvarchar(4000)
DECLARE @email nvarchar(4000)
DECLARE @user_type nvarchar(4000)
DECLARE @start_time nvarchar(4000)
DECLARE @end_time nvarchar(4000)
DECLARE @duration nvarchar(4000)
DECLARE @participants nvarchar(4000)
DECLARE @has_pstn nvarchar(4000)
DECLARE @has_voip nvarchar(4000)
DECLARE @has_3rd_party_audio nvarchar(4000)
DECLARE @has_video nvarchar(4000)
DECLARE @has_screen_share nvarchar(4000)
DECLARE @has_recording nvarchar(4000)
DECLARE @has_sip nvarchar(4000)
DECLARE @has_archiving nvarchar(4000)
DECLARE @from nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @from OUT, 'from'
DECLARE @v_to nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_to OUT, 'to'
DECLARE @page_count nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @page_count OUT, 'page_count'
DECLARE @page_size nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @page_size OUT, 'page_size'
DECLARE @total_records nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @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, 'meetings'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @uuid OUT, 'meetings[i].uuid'
EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'meetings[i].id'
EXEC sp_OAMethod @jResp, 'StringOf', @topic OUT, 'meetings[i].topic'
EXEC sp_OAMethod @jResp, 'StringOf', @host OUT, 'meetings[i].host'
EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'meetings[i].email'
EXEC sp_OAMethod @jResp, 'StringOf', @user_type OUT, 'meetings[i].user_type'
EXEC sp_OAMethod @jResp, 'StringOf', @start_time OUT, 'meetings[i].start_time'
EXEC sp_OAMethod @jResp, 'StringOf', @end_time OUT, 'meetings[i].end_time'
EXEC sp_OAMethod @jResp, 'StringOf', @duration OUT, 'meetings[i].duration'
EXEC sp_OAMethod @jResp, 'StringOf', @participants OUT, 'meetings[i].participants'
EXEC sp_OAMethod @jResp, 'StringOf', @has_pstn OUT, 'meetings[i].has_pstn'
EXEC sp_OAMethod @jResp, 'StringOf', @has_voip OUT, 'meetings[i].has_voip'
EXEC sp_OAMethod @jResp, 'StringOf', @has_3rd_party_audio OUT, 'meetings[i].has_3rd_party_audio'
EXEC sp_OAMethod @jResp, 'StringOf', @has_video OUT, 'meetings[i].has_video'
EXEC sp_OAMethod @jResp, 'StringOf', @has_screen_share OUT, 'meetings[i].has_screen_share'
EXEC sp_OAMethod @jResp, 'StringOf', @has_recording OUT, 'meetings[i].has_recording'
EXEC sp_OAMethod @jResp, 'StringOf', @has_sip OUT, 'meetings[i].has_sip'
EXEC sp_OAMethod @jResp, 'StringOf', @has_archiving OUT, 'meetings[i].has_archiving'
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 "from=1989-05-07"
-d "to=1989-05-07"
-d "page_size=30"
-d "next_page_token=quis%20officia%20in%20reprehenderit"
-d "include_fields=tracking_fields"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/metrics/meetings
Postman Collection Item JSON
{
"name": "List meetings",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/metrics/meetings?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=tracking_fields",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"meetings"
],
"query": [
{
"key": "type",
"value": "live",
"description": "Specify a value to get the response for the corresponding meeting type. The value of this field can be one of the following:<br> <br>`past` - Meeting that already occurred in the specified date range.<br>`pastOne` - Past meetings that were attended by only one user. <br>`live` - Live meetings.<br><br>\n\nIf you do not provide this field, the default value will be `live` and thus, the API will only query responses for live meetings."
},
{
"key": "from",
"value": "1989-05-07",
"description": "(Required) Start date in 'yyyy-mm-dd' format. The date range defined by the \"from\" and \"to\" parameters should only be one month as the report includes only one month worth of data at once."
},
{
"key": "to",
"value": "1989-05-07",
"description": "(Required) End date."
},
{
"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": "tracking_fields",
"description": "Set the value of this field to \"tracking_fields\" if you would like to include tracking fields of each meeting in the response."
}
]
},
"description": "List total live or past meetings that occurred during a specified period of time. This overview will show if features such as audio, video, screen sharing, and recording were being used in the meeting. You can also see the license types of each user on your account.<br> You can specify a monthly date range for the dashboard data using the `from` and `to` query parameters. The month should fall within the last six months.<br>\n**Scopes:** `dashboard_meetings:read:admin`<br>\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Resource-intensive`<br><br>\n**Prerequisites:** <br>\n* Business or a higher plan.<br><br>"
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nMeetings returned.<br>\nOnly available for paid accounts that have dashboard feature enabled.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/meetings?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=tracking_fields",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"meetings"
],
"query": [
{
"key": "type",
"value": "live"
},
{
"key": "from",
"value": "1989-05-07"
},
{
"key": "to",
"value": "1989-05-07"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "tracking_fields"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"from\": \"string [date]\",\n \"to\": \"string [date]\",\n \"page_count\": \"integer\",\n \"page_size\": \"integer\",\n \"total_records\": \"integer\",\n \"next_page_token\": \"string\",\n \"meetings\": [\n {\n \"uuid\": \"string [uuid]\",\n \"id\": \"integer\",\n \"topic\": \"string\",\n \"host\": \"string\",\n \"email\": \"string\",\n \"user_type\": \"string\",\n \"start_time\": \"string [date-time]\",\n \"end_time\": \"string [date-time]\",\n \"duration\": \"string\",\n \"participants\": \"integer\",\n \"has_pstn\": \"boolean\",\n \"has_voip\": \"boolean\",\n \"has_3rd_party_audio\": \"boolean\",\n \"has_video\": \"boolean\",\n \"has_screen_share\": \"boolean\",\n \"has_recording\": \"boolean\",\n \"has_sip\": \"boolean\",\n \"has_archiving\": \"boolean\"\n }\n ]\n}"
},
{
"name": "**Error Code:** `300`<br>\nThe next page token is invalid or expired.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/meetings?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=tracking_fields",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"meetings"
],
"query": [
{
"key": "type",
"value": "live"
},
{
"key": "from",
"value": "1989-05-07"
},
{
"key": "to",
"value": "1989-05-07"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "tracking_fields"
}
]
}
},
"status": "Multiple Choices",
"code": 300,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}