PureBasic / Zoom API / List webinars
Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
queryParams.i = CkJsonObject::ckCreate()
If queryParams.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(queryParams,"type","live")
CkJsonObject::ckUpdateString(queryParams,"from","1989-05-07")
CkJsonObject::ckUpdateString(queryParams,"to","1989-05-07")
CkJsonObject::ckUpdateInt(queryParams,"page_size",30)
CkJsonObject::ckUpdateString(queryParams,"next_page_token","quis officia in reprehenderit")
; Adds the "Authorization: Bearer <access_token>" header.
CkHttp::setCkAuthToken(http, "<access_token>")
resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://api.zoom.us/v2/metrics/webinars",queryParams)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
ProcedureReturn
EndIf
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpResponse::ckGetBodySb(resp,sbResponseBody)
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,sbResponseBody)
CkJsonObject::setCkEmitCompact(jResp, 0)
Debug "Response Body:"
Debug CkJsonObject::ckEmit(jResp)
respStatusCode.i = CkHttpResponse::ckStatusCode(resp)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode >= 400
Debug "Response Header:"
Debug CkHttpResponse::ckHeader(resp)
Debug "Failed."
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndIf
CkHttpResponse::ckDispose(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",
; "webinars": [
; {
; "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
uuid.s
id.s
topic.s
host.s
email.s
user_type.s
start_time.s
end_time.s
duration.s
participants.s
has_pstn.s
has_voip.s
has_3rd_party_audio.s
has_video.s
has_screen_share.s
has_recording.s
has_sip.s
has_archiving.s
from.s = CkJsonObject::ckStringOf(jResp,"from")
v_to.s = CkJsonObject::ckStringOf(jResp,"to")
page_count.s = CkJsonObject::ckStringOf(jResp,"page_count")
page_size.s = CkJsonObject::ckStringOf(jResp,"page_size")
total_records.s = CkJsonObject::ckStringOf(jResp,"total_records")
next_page_token.s = CkJsonObject::ckStringOf(jResp,"next_page_token")
i.i = 0
count_i.i = CkJsonObject::ckSizeOfArray(jResp,"webinars")
While i < count_i
CkJsonObject::setCkI(jResp, i)
uuid = CkJsonObject::ckStringOf(jResp,"webinars[i].uuid")
id = CkJsonObject::ckStringOf(jResp,"webinars[i].id")
topic = CkJsonObject::ckStringOf(jResp,"webinars[i].topic")
host = CkJsonObject::ckStringOf(jResp,"webinars[i].host")
email = CkJsonObject::ckStringOf(jResp,"webinars[i].email")
user_type = CkJsonObject::ckStringOf(jResp,"webinars[i].user_type")
start_time = CkJsonObject::ckStringOf(jResp,"webinars[i].start_time")
end_time = CkJsonObject::ckStringOf(jResp,"webinars[i].end_time")
duration = CkJsonObject::ckStringOf(jResp,"webinars[i].duration")
participants = CkJsonObject::ckStringOf(jResp,"webinars[i].participants")
has_pstn = CkJsonObject::ckStringOf(jResp,"webinars[i].has_pstn")
has_voip = CkJsonObject::ckStringOf(jResp,"webinars[i].has_voip")
has_3rd_party_audio = CkJsonObject::ckStringOf(jResp,"webinars[i].has_3rd_party_audio")
has_video = CkJsonObject::ckStringOf(jResp,"webinars[i].has_video")
has_screen_share = CkJsonObject::ckStringOf(jResp,"webinars[i].has_screen_share")
has_recording = CkJsonObject::ckStringOf(jResp,"webinars[i].has_recording")
has_sip = CkJsonObject::ckStringOf(jResp,"webinars[i].has_sip")
has_archiving = CkJsonObject::ckStringOf(jResp,"webinars[i].has_archiving")
i = i + 1
Wend
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure
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"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/metrics/webinars
Postman Collection Item JSON
{
"name": "List webinars",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars"
],
"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": "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."
}
]
},
"description": "List all the live or past webinars from a specified period of time. <br><br>\n**Scopes:** `dashboard_webinars:read:admin`<br>\n**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Resource-intensive`<br>\n**Prerequisites:**<br>\n* Business, Education or API Plan with Webinar add-on.\n\n\n"
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nMeetings returned.<br>\nOnly available for paid accounts that have enabled the Dashboard feature.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars"
],
"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"
}
]
}
},
"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 \"webinars\": [\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:** `200`<br>\nThe next page token is invalid or has expired.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/metrics/webinars?type=live&from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"webinars"
],
"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"
}
]
}
},
"status": "Multiple Choices",
"code": 300,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}