Chilkat Online Tools

unicodeC / Zoom API / Get Zoom Rooms details

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW queryParams;
    HCkHttpResponseW resp;
    HCkStringBuilderW sbResponseBody;
    HCkJsonObjectW jResp;
    int respStatusCode;
    const wchar_t *strVal;
    const wchar_t *account_type;
    const wchar_t *calendar_name;
    const wchar_t *camera;
    const wchar_t *device_ip;
    const wchar_t *email;
    const wchar_t *health;
    const wchar_t *id;
    const wchar_t *last_start_time;
    const wchar_t *microphone;
    const wchar_t *From;
    const wchar_t *Next_page_token;
    int Page_count;
    int Page_size;
    const wchar_t *v_To;
    int Total_records;
    const wchar_t *room_name;
    const wchar_t *speaker;
    const wchar_t *status;
    int i;
    int count_i;

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

    http = CkHttpW_Create();

    queryParams = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(queryParams,L"from",L"1989-05-07");
    CkJsonObjectW_UpdateString(queryParams,L"to",L"1989-05-07");
    CkJsonObjectW_UpdateInt(queryParams,L"page_size",30);
    CkJsonObjectW_UpdateString(queryParams,L"next_page_token",L"quis officia in reprehenderit");

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

    resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://api.zoom.us/v2/metrics/zoomrooms/:zoomroomId",queryParams);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        return;
    }

    sbResponseBody = CkStringBuilderW_Create();
    CkHttpResponseW_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(jResp,sbResponseBody);
    CkJsonObjectW_putEmitCompact(jResp,FALSE);

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

    respStatusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",CkHttpResponseW_header(resp));
        wprintf(L"Failed.\n");
        CkHttpResponseW_Dispose(resp);
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        CkStringBuilderW_Dispose(sbResponseBody);
        CkJsonObjectW_Dispose(jResp);
        return;
    }

    CkHttpResponseW_Dispose(resp);

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "account_type": "Work Email",
    //   "calendar_name": "testZoomRoom",
    //   "camera": "Integrated Webcam",
    //   "device_ip": "Computer : 192.0.2.0; Controller : 192.0.2.1",
    //   "email": "example@example.com",
    //   "health": "critical",
    //   "id": "fdjdsfdYYYYY",
    //   "issues": [
    //     "Zoom room is offline"
    //   ],
    //   "last_start_time": "2020-01-30T17:47:47Z",
    //   "live_meeting": {},
    //   "microphone": "Microphone Array (Realtek Audio)",
    //   "past_meetings": {
    //     "from": "2020-03-01",
    //     "meetings": [
    //     ],
    //     "next_page_token": "",
    //     "page_count": 0,
    //     "page_size": 30,
    //     "to": "2020-03-02",
    //     "total_records": 0
    //   },
    //   "room_name": "testZoomRoom",
    //   "speaker": "Speakers / Headphones (Realtek Audio)",
    //   "status": "Offline"
    // }

    // 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.

    account_type = CkJsonObjectW_stringOf(jResp,L"account_type");
    calendar_name = CkJsonObjectW_stringOf(jResp,L"calendar_name");
    camera = CkJsonObjectW_stringOf(jResp,L"camera");
    device_ip = CkJsonObjectW_stringOf(jResp,L"device_ip");
    email = CkJsonObjectW_stringOf(jResp,L"email");
    health = CkJsonObjectW_stringOf(jResp,L"health");
    id = CkJsonObjectW_stringOf(jResp,L"id");
    last_start_time = CkJsonObjectW_stringOf(jResp,L"last_start_time");
    microphone = CkJsonObjectW_stringOf(jResp,L"microphone");
    From = CkJsonObjectW_stringOf(jResp,L"past_meetings.from");
    Next_page_token = CkJsonObjectW_stringOf(jResp,L"past_meetings.next_page_token");
    Page_count = CkJsonObjectW_IntOf(jResp,L"past_meetings.page_count");
    Page_size = CkJsonObjectW_IntOf(jResp,L"past_meetings.page_size");
    v_To = CkJsonObjectW_stringOf(jResp,L"past_meetings.to");
    Total_records = CkJsonObjectW_IntOf(jResp,L"past_meetings.total_records");
    room_name = CkJsonObjectW_stringOf(jResp,L"room_name");
    speaker = CkJsonObjectW_stringOf(jResp,L"speaker");
    status = CkJsonObjectW_stringOf(jResp,L"status");
    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"issues");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        strVal = CkJsonObjectW_stringOf(jResp,L"issues[i]");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"past_meetings.meetings");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        i = i + 1;
    }



    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(queryParams);
    CkStringBuilderW_Dispose(sbResponseBody);
    CkJsonObjectW_Dispose(jResp);

    }

Curl Command

curl -G -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/zoomrooms/:zoomroomId

Postman Collection Item JSON

{
  "name": "Get Zoom Rooms details",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/metrics/zoomrooms/:zoomroomId?from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "metrics",
        "zoomrooms",
        ":zoomroomId"
      ],
      "query": [
        {
          "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."
        }
      ],
      "variable": [
        {
          "key": "zoomroomId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The Zoom room ID."
        }
      ]
    },
    "description": "The Zoom Rooms dashboard metrics lets you know the type of configuration a Zoom room has and details on the meetings held in that room. \n\nUse this API to retrieve information on a specific room.<br><br>\n**Scopes:** `dashboard_zr:read:admin`<br> <br>\n\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`**Prerequisites:**<br>\n* Business, Education or API Plan with Zoom Rooms set up.\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nZoom room 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/:zoomroomId?from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "metrics",
            "zoomrooms",
            ":zoomroomId"
          ],
          "query": [
            {
              "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"
            }
          ],
          "variable": [
            {
              "key": "zoomroomId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The Zoom room ID."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"account_type\": \"Work Email\",\n \"calendar_name\": \"testZoomRoom\",\n \"camera\": \"Integrated Webcam\",\n \"device_ip\": \"Computer : 192.0.2.0; Controller : 192.0.2.1\",\n \"email\": \"example@example.com\",\n \"health\": \"critical\",\n \"id\": \"fdjdsfdYYYYY\",\n \"issues\": [\n  \"Zoom room is offline\"\n ],\n \"last_start_time\": \"2020-01-30T17:47:47Z\",\n \"live_meeting\": {},\n \"microphone\": \"Microphone Array (Realtek Audio)\",\n \"past_meetings\": {\n  \"from\": \"2020-03-01\",\n  \"meetings\": [],\n  \"next_page_token\": \"\",\n  \"page_count\": 0,\n  \"page_size\": 30,\n  \"to\": \"2020-03-02\",\n  \"total_records\": 0\n },\n \"room_name\": \"testZoomRoom\",\n \"speaker\": \"Speakers / Headphones (Realtek Audio)\",\n \"status\": \"Offline\"\n}"
    },
    {
      "name": "**Error Code:** `300`<br>\nThe next page token is either 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/zoomrooms/:zoomroomId?from=1989-05-07&to=1989-05-07&page_size=30&next_page_token=quis officia in reprehenderit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "metrics",
            "zoomrooms",
            ":zoomroomId"
          ],
          "query": [
            {
              "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"
            }
          ],
          "variable": [
            {
              "key": "zoomroomId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The Zoom room ID."
            }
          ]
        }
      },
      "status": "Multiple Choices",
      "code": 300,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}