Chilkat Online Tools

unicodeCpp / Zoom API / List Zoom Rooms

Back to Collection Items

#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;
    bool success;

    CkJsonObjectW queryParams;
    queryParams.UpdateInt(L"page_size",30);
    queryParams.UpdateInt(L"page_number",1);
    queryParams.UpdateString(L"next_page_token",L"quis officia in reprehenderit");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken(L"<access_token>");

    CkHttpResponseW *resp = http.QuickRequestParams(L"GET",L"https://api.zoom.us/v2/metrics/zoomrooms",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    CkStringBuilderW sbResponseBody;
    resp->GetBodySb(sbResponseBody);

    CkJsonObjectW jResp;
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",jResp.emit());

    int respStatusCode = resp->get_StatusCode();
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",resp->header());
        wprintf(L"Failed.\n");
        delete resp;
        return;
    }

    delete 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

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    const wchar_t *id = 0;
    const wchar_t *room_name = 0;
    const wchar_t *calendar_name = 0;
    const wchar_t *email = 0;
    const wchar_t *account_type = 0;
    const wchar_t *status = 0;
    const wchar_t *device_ip = 0;
    const wchar_t *camera = 0;
    const wchar_t *microphone = 0;
    const wchar_t *speaker = 0;
    const wchar_t *last_start_time = 0;
    const wchar_t *health = 0;
    int j;
    int count_j;
    const wchar_t *strVal = 0;

    int page_count = jResp.IntOf(L"page_count");
    int page_number = jResp.IntOf(L"page_number");
    int page_size = jResp.IntOf(L"page_size");
    int total_records = jResp.IntOf(L"total_records");
    int i = 0;
    int count_i = jResp.SizeOfArray(L"zoom_rooms");
    while (i < count_i) {
        jResp.put_I(i);
        id = jResp.stringOf(L"zoom_rooms[i].id");
        room_name = jResp.stringOf(L"zoom_rooms[i].room_name");
        calendar_name = jResp.stringOf(L"zoom_rooms[i].calendar_name");
        email = jResp.stringOf(L"zoom_rooms[i].email");
        account_type = jResp.stringOf(L"zoom_rooms[i].account_type");
        status = jResp.stringOf(L"zoom_rooms[i].status");
        device_ip = jResp.stringOf(L"zoom_rooms[i].device_ip");
        camera = jResp.stringOf(L"zoom_rooms[i].camera");
        microphone = jResp.stringOf(L"zoom_rooms[i].microphone");
        speaker = jResp.stringOf(L"zoom_rooms[i].speaker");
        last_start_time = jResp.stringOf(L"zoom_rooms[i].last_start_time");
        health = jResp.stringOf(L"zoom_rooms[i].health");
        j = 0;
        count_j = jResp.SizeOfArray(L"zoom_rooms[i].issues");
        while (j < count_j) {
            jResp.put_J(j);
            strVal = jResp.stringOf(L"zoom_rooms[i].issues[j]");
            j = j + 1;
        }

        i = i + 1;
    }
    }

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}"
    }
  ]
}