Chilkat Online Tools

SQL Server / Zoom API / Get Zoom Rooms details

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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    DECLARE @queryParams int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @queryParams OUT

    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'

    -- 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/zoomrooms/:zoomroomId', @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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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)

    -- {
    --   "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

    DECLARE @strVal nvarchar(4000)

    DECLARE @account_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @account_type OUT, 'account_type'
    DECLARE @calendar_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @calendar_name OUT, 'calendar_name'
    DECLARE @camera nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @camera OUT, 'camera'
    DECLARE @device_ip nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @device_ip OUT, 'device_ip'
    DECLARE @email nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'email'
    DECLARE @health nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @health OUT, 'health'
    DECLARE @id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'id'
    DECLARE @last_start_time nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @last_start_time OUT, 'last_start_time'
    DECLARE @microphone nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @microphone OUT, 'microphone'
    DECLARE @From nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @From OUT, 'past_meetings.from'
    DECLARE @Next_page_token nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Next_page_token OUT, 'past_meetings.next_page_token'
    DECLARE @Page_count int
    EXEC sp_OAMethod @jResp, 'IntOf', @Page_count OUT, 'past_meetings.page_count'
    DECLARE @Page_size int
    EXEC sp_OAMethod @jResp, 'IntOf', @Page_size OUT, 'past_meetings.page_size'
    DECLARE @v_To nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_To OUT, 'past_meetings.to'
    DECLARE @Total_records int
    EXEC sp_OAMethod @jResp, 'IntOf', @Total_records OUT, 'past_meetings.total_records'
    DECLARE @room_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @room_name OUT, 'room_name'
    DECLARE @speaker nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @speaker OUT, 'speaker'
    DECLARE @status nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'issues'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'issues[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'past_meetings.meetings'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        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 "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": ""
    }
  ]
}