Chilkat Online Tools

SQL Server / Zoom API / List archived files

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, 'UpdateInt', @success OUT, 'page_size', 30
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'next_page_token', 'quis officia in reprehenderit'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'from', 'quis officia in reprehenderit'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'to', 'quis officia in reprehenderit'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'query_date_type', 'meeting_start_time'

    -- 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/archive_files', @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)

    -- {
    --   "from": "2021-03-11T05:41:36Z",
    --   "to": "2021-03-18T05:41:36Z",
    --   "page_size": 30,
    --   "next_page_token": "",
    --   "meetings": [
    --     {
    --       "uuid": "yO3dfhh3t467UkQ==",
    --       "id": 553068284,
    --       "host_id": "Dhjdfgdkg8w",
    --       "topic": "Zoom Meeting",
    --       "type": 1,
    --       "start_time": "2021-03-12T01:57:27Z",
    --       "timezone": "",
    --       "duration": 3,
    --       "total_size": 364463,
    --       "recording_count": 2,
    --       "meeting_type": "internal",
    --       "account_name": "account_01",
    --       "complete_time": "2021-03-12T02:57:27Z",
    --       "is_breakout_room": false,
    --       "archive_files": [
    --         {
    --           "id": "55hfgsd-sd8e2bd7255",
    --           "file_type": "M4A",
    --           "file_extension": "M4A",
    --           "file_size": 165743,
    --           "download_url": "https://example.com/recording/download/Qg75t7xZBtEbAkjdlgbfdngBBBB",
    --           "status": "completed",
    --           "recording_type": "audio_only",
    --           "individual": true,
    --           "participant_email": "user@example.com",
    --           "participant_join_time": "2021-03-12T02:07:27Z",
    --           "participant_leave_time": "2021-03-12T02:12:27Z"
    --         },
    --         {
    --           "id": "9c5daa5b-34a1-40e8-8947-a11be5e373a7",
    --           "file_type": "MP4",
    --           "file_extension": "MP4",
    --           "file_size": 198720,
    --           "download_url": "https://example.com/recording/download/Qg75t7xZBtEbAkjdlgbfdngCCCC",
    --           "status": "completed",
    --           "recording_type": "shared_screen_with_speaker_view",
    --           "individual": true,
    --           "participant_email": "user1@example.com",
    --           "participant_join_time": "2021-03-12T02:07:27Z",
    --           "participant_leave_time": "2021-03-12T02:12:27Z"
    --         }
    --       ]
    --     }
    --   ]
    -- }

    -- Sample code for parsing the JSON response...
    -- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    DECLARE @uuid nvarchar(4000)

    DECLARE @id int

    DECLARE @host_id nvarchar(4000)

    DECLARE @topic nvarchar(4000)

    DECLARE @v_type int

    DECLARE @start_time nvarchar(4000)

    DECLARE @timezone nvarchar(4000)

    DECLARE @duration int

    DECLARE @total_size int

    DECLARE @recording_count int

    DECLARE @meeting_type nvarchar(4000)

    DECLARE @account_name nvarchar(4000)

    DECLARE @complete_time nvarchar(4000)

    DECLARE @is_breakout_room int

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @id_str nvarchar(4000)

    DECLARE @file_type nvarchar(4000)

    DECLARE @file_extension nvarchar(4000)

    DECLARE @file_size int

    DECLARE @download_url nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @recording_type nvarchar(4000)

    DECLARE @individual int

    DECLARE @participant_email nvarchar(4000)

    DECLARE @participant_join_time nvarchar(4000)

    DECLARE @participant_leave_time nvarchar(4000)

    DECLARE @from nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @from OUT, 'from'
    DECLARE @v_to nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_to OUT, 'to'
    DECLARE @page_size int
    EXEC sp_OAMethod @jResp, 'IntOf', @page_size OUT, 'page_size'
    DECLARE @next_page_token nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @next_page_token OUT, 'next_page_token'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'meetings'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @uuid OUT, 'meetings[i].uuid'
        EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'meetings[i].id'
        EXEC sp_OAMethod @jResp, 'StringOf', @host_id OUT, 'meetings[i].host_id'
        EXEC sp_OAMethod @jResp, 'StringOf', @topic OUT, 'meetings[i].topic'
        EXEC sp_OAMethod @jResp, 'IntOf', @v_type OUT, 'meetings[i].type'
        EXEC sp_OAMethod @jResp, 'StringOf', @start_time OUT, 'meetings[i].start_time'
        EXEC sp_OAMethod @jResp, 'StringOf', @timezone OUT, 'meetings[i].timezone'
        EXEC sp_OAMethod @jResp, 'IntOf', @duration OUT, 'meetings[i].duration'
        EXEC sp_OAMethod @jResp, 'IntOf', @total_size OUT, 'meetings[i].total_size'
        EXEC sp_OAMethod @jResp, 'IntOf', @recording_count OUT, 'meetings[i].recording_count'
        EXEC sp_OAMethod @jResp, 'StringOf', @meeting_type OUT, 'meetings[i].meeting_type'
        EXEC sp_OAMethod @jResp, 'StringOf', @account_name OUT, 'meetings[i].account_name'
        EXEC sp_OAMethod @jResp, 'StringOf', @complete_time OUT, 'meetings[i].complete_time'
        EXEC sp_OAMethod @jResp, 'BoolOf', @is_breakout_room OUT, 'meetings[i].is_breakout_room'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'meetings[i].archive_files'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @id_str OUT, 'meetings[i].archive_files[j].id'
            EXEC sp_OAMethod @jResp, 'StringOf', @file_type OUT, 'meetings[i].archive_files[j].file_type'
            EXEC sp_OAMethod @jResp, 'StringOf', @file_extension OUT, 'meetings[i].archive_files[j].file_extension'
            EXEC sp_OAMethod @jResp, 'IntOf', @file_size OUT, 'meetings[i].archive_files[j].file_size'
            EXEC sp_OAMethod @jResp, 'StringOf', @download_url OUT, 'meetings[i].archive_files[j].download_url'
            EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'meetings[i].archive_files[j].status'
            EXEC sp_OAMethod @jResp, 'StringOf', @recording_type OUT, 'meetings[i].archive_files[j].recording_type'
            EXEC sp_OAMethod @jResp, 'BoolOf', @individual OUT, 'meetings[i].archive_files[j].individual'
            EXEC sp_OAMethod @jResp, 'StringOf', @participant_email OUT, 'meetings[i].archive_files[j].participant_email'
            EXEC sp_OAMethod @jResp, 'StringOf', @participant_join_time OUT, 'meetings[i].archive_files[j].participant_join_time'
            EXEC sp_OAMethod @jResp, 'StringOf', @participant_leave_time OUT, 'meetings[i].archive_files[j].participant_leave_time'
            SELECT @j = @j + 1
          END
        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 "page_size=30"
	-d "next_page_token=quis%20officia%20in%20reprehenderit"
	-d "from=quis%20officia%20in%20reprehenderit"
	-d "to=quis%20officia%20in%20reprehenderit"
	-d "query_date_type=meeting_start_time"
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/archive_files

Postman Collection Item JSON

{
  "name": "List archived files",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/archive_files?page_size=30&next_page_token=quis officia in reprehenderit&from=quis officia in reprehenderit&to=quis officia in reprehenderit&query_date_type=meeting_start_time",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "archive_files"
      ],
      "query": [
        {
          "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."
        },
        {
          "key": "from",
          "value": "quis officia in reprehenderit",
          "description": "Start date for the query in \"yyyy-MM-dd'T'HH:mm:ss'Z'\" format. The duration for the query defined using the \"from\" and \"to\" parameters should not exceed 7 days as this API only provides a week's data at once."
        },
        {
          "key": "to",
          "value": "quis officia in reprehenderit",
          "description": "End date for the query in \"yyyy-MM-dd'T'HH:mm:ss'Z'\" format. "
        },
        {
          "key": "query_date_type",
          "value": "meeting_start_time",
          "description": "The query date type for the `from` and `to` parameters."
        }
      ]
    },
    "description": "Use this API to retrieve archived meeting or webinar files of an account. \n\n Zoom’s [archiving solution](https://support.zoom.us/hc/en-us/articles/360050431572-Archiving-Meeting-and-Webinar-data) allows account administrators to set up an automated mechanism to record, collect, and archive meeting data to a 3rd-party platform of their choice to satisfy FINRA and/or other compliance requirements. \n\n**Scopes:** `recording:read:admin` <br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium` \n\n**Prerequisites:** \n* Follow the [enablement process](https://support.zoom.us/hc/en-us/articles/360050431572-Archiving-Meeting-and-Webinar-data#h_01ENPBD3WR68D7FAKTBY92SG45) to access the archiving feature."
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200` **OK**\nArchived files returned.\n",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/archive_files?page_size=30&next_page_token=quis officia in reprehenderit&from=quis officia in reprehenderit&to=quis officia in reprehenderit&query_date_type=meeting_start_time",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "archive_files"
          ],
          "query": [
            {
              "key": "page_size",
              "value": "30"
            },
            {
              "key": "next_page_token",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "from",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "to",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "query_date_type",
              "value": "meeting_start_time"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"from\": \"2021-03-11T05:41:36Z\",\n \"to\": \"2021-03-18T05:41:36Z\",\n \"page_size\": 30,\n \"next_page_token\": \"\",\n \"meetings\": [\n  {\n   \"uuid\": \"yO3dfhh3t467UkQ==\",\n   \"id\": 553068284,\n   \"host_id\": \"Dhjdfgdkg8w\",\n   \"topic\": \"Zoom Meeting\",\n   \"type\": 1,\n   \"start_time\": \"2021-03-12T01:57:27Z\",\n   \"timezone\": \"\",\n   \"duration\": 3,\n   \"total_size\": 364463,\n   \"recording_count\": 2,\n   \"meeting_type\": \"internal\",\n   \"account_name\": \"account_01\",\n   \"complete_time\": \"2021-03-12T02:57:27Z\",\n   \"is_breakout_room\": false,\n   \"archive_files\": [\n    {\n     \"id\": \"55hfgsd-sd8e2bd7255\",\n     \"file_type\": \"M4A\",\n     \"file_extension\": \"M4A\",\n     \"file_size\": 165743,\n     \"download_url\": \"https://example.com/recording/download/Qg75t7xZBtEbAkjdlgbfdngBBBB\",\n     \"status\": \"completed\",\n     \"recording_type\": \"audio_only\",\n     \"individual\": true,\n     \"participant_email\": \"user@example.com\",\n     \"participant_join_time\": \"2021-03-12T02:07:27Z\",\n     \"participant_leave_time\": \"2021-03-12T02:12:27Z\"\n    },\n    {\n     \"id\": \"9c5daa5b-34a1-40e8-8947-a11be5e373a7\",\n     \"file_type\": \"MP4\",\n     \"file_extension\": \"MP4\",\n     \"file_size\": 198720,\n     \"download_url\": \"https://example.com/recording/download/Qg75t7xZBtEbAkjdlgbfdngCCCC\",\n     \"status\": \"completed\",\n     \"recording_type\": \"shared_screen_with_speaker_view\",\n     \"individual\": true,\n     \"participant_email\": \"user1@example.com\",\n     \"participant_join_time\": \"2021-03-12T02:07:27Z\",\n     \"participant_leave_time\": \"2021-03-12T02:12:27Z\"\n    }\n   ]\n  }\n ]\n}"
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad request**<br>\n**Error Code:** `2001`<br>\nAccount does not exist: {accountId}.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/archive_files?page_size=30&next_page_token=quis officia in reprehenderit&from=quis officia in reprehenderit&to=quis officia in reprehenderit&query_date_type=meeting_start_time",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "archive_files"
          ],
          "query": [
            {
              "key": "page_size",
              "value": "30"
            },
            {
              "key": "next_page_token",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "from",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "to",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "query_date_type",
              "value": "meeting_start_time"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}