PureBasic / Zoom API / List Zoom Rooms
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::ckUpdateInt(queryParams,"page_size",30)
CkJsonObject::ckUpdateInt(queryParams,"page_number",1)
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/zoomrooms",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)
; {
; "page_count": 1,
; "page_number": 1,
; "page_size": 30,
; "total_records": 1,
; "zoom_rooms": [
; {
; "id": "EbgjgjhghZY9wh0A",
; "room_name": "testZoomRoom",
; "calendar_name": "example.cal",
; "email": "example@example.com",
; "account_type": "Work Email",
; "status": "Offline",
; "device_ip": "Computer : 192.0.2.0",
; "camera": "Integrated Webcam",
; "microphone": "Microphone Array (Realtek Audio)",
; "speaker": "Speakers / Headphones (Realtek Audio)",
; "last_start_time": "2019-08-29T16:37:07Z",
; "issues": [
; "Zoom room is offline"
; ],
; "health": "critical"
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
id.s
room_name.s
calendar_name.s
email.s
account_type.s
status.s
device_ip.s
camera.s
microphone.s
speaker.s
last_start_time.s
health.s
j.i
count_j.i
strVal.s
page_count.i = CkJsonObject::ckIntOf(jResp,"page_count")
page_number.i = CkJsonObject::ckIntOf(jResp,"page_number")
page_size.i = CkJsonObject::ckIntOf(jResp,"page_size")
total_records.i = CkJsonObject::ckIntOf(jResp,"total_records")
i.i = 0
count_i.i = CkJsonObject::ckSizeOfArray(jResp,"zoom_rooms")
While i < count_i
CkJsonObject::setCkI(jResp, i)
id = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].id")
room_name = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].room_name")
calendar_name = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].calendar_name")
email = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].email")
account_type = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].account_type")
status = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].status")
device_ip = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].device_ip")
camera = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].camera")
microphone = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].microphone")
speaker = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].speaker")
last_start_time = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].last_start_time")
health = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].health")
j = 0
count_j = CkJsonObject::ckSizeOfArray(jResp,"zoom_rooms[i].issues")
While j < count_j
CkJsonObject::setCkJ(jResp, j)
strVal = CkJsonObject::ckStringOf(jResp,"zoom_rooms[i].issues[j]")
j = j + 1
Wend
i = i + 1
Wend
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(queryParams)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure
Curl Command
curl -G -d "page_size=30"
-d "page_number=1"
-d "next_page_token=quis%20officia%20in%20reprehenderit"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/metrics/zoomrooms
Postman Collection Item JSON
{
"name": "List Zoom Rooms",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/metrics/zoomrooms?page_size=30&page_number=1&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"zoomrooms"
],
"query": [
{
"key": "page_size",
"value": "30",
"description": "The number of records returned within a single API call."
},
{
"key": "page_number",
"value": "1",
"description": "The page number of the current page in the returned records."
},
{
"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 information on all Zoom Rooms in an account.<br><br>\n**Scopes:** `dashboard_zr:read:admin`\n\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 Zoom Rooms set up.\n\n\n"
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nList of Zoom rooms 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/zoomrooms?page_size=30&page_number=1&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"metrics",
"zoomrooms"
],
"query": [
{
"key": "page_size",
"value": "30"
},
{
"key": "page_number",
"value": "1"
},
{
"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 \"page_count\": 1,\n \"page_number\": 1,\n \"page_size\": 30,\n \"total_records\": 1,\n \"zoom_rooms\": [\n {\n \"id\": \"EbgjgjhghZY9wh0A\",\n \"room_name\": \"testZoomRoom\",\n \"calendar_name\": \"example.cal\",\n \"email\": \"example@example.com\",\n \"account_type\": \"Work Email\",\n \"status\": \"Offline\",\n \"device_ip\": \"Computer : 192.0.2.0\",\n \"camera\": \"Integrated Webcam\",\n \"microphone\": \"Microphone Array (Realtek Audio)\",\n \"speaker\": \"Speakers / Headphones (Realtek Audio)\",\n \"last_start_time\": \"2019-08-29T16:37:07Z\",\n \"issues\": [\n \"Zoom room is offline\"\n ],\n \"health\": \"critical\"\n }\n ]\n}"
}
]
}