Chilkat Online Tools

SQL Server / Zoom API / Get telephone reports

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, 'type', 1
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'query_date_type', 'start_time'
    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, 'UpdateInt', @success OUT, 'page_number', 1
    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/report/telephone', @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


    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 "type=1"
	-d "query_date_type=start_time"
	-d "from=1989-05-07"
	-d "to=1989-05-07"
	-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/report/telephone

Postman Collection Item JSON

{
  "name": "Get telephone reports",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/report/telephone?type=1&query_date_type=start_time&from=1989-05-07&to=1989-05-07&page_size=30&page_number=1&next_page_token=quis officia in reprehenderit",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "report",
        "telephone"
      ],
      "query": [
        {
          "key": "type",
          "value": "1",
          "description": "Audio types:<br>`1` - Toll-free Call-in & Call-out.<br>`2` - Toll <br>\n`3` - SIP Connected Audio"
        },
        {
          "key": "query_date_type",
          "value": "start_time",
          "description": "The type of date to query: \n* `start_time` — Query by call start time. \n* `end_time` — Query by call end time. \n* `meeting_start_time` — Query by meeting start time. \n* `meeting_end_time` — Query by meeting end time. \n\nThis value defaults to `start_time`."
        },
        {
          "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": "page_number",
          "value": "1",
          "description": "The page number of the current page in the returned records. This field is **not** available if the `query_date_type` parameter is the `meeting_start_time` or `meeting_end_time` value. \n\n**DEPRECATED** — This field is deprecated and we will no longer support it in a future release. Instead, use the `next_page_token` query parameter for pagination."
        },
        {
          "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": "The [telephone report](https://support.zoom.us/hc/en-us/articles/206514816-Telephone-reports) allows you to view who dialed into meetings via phone (Audio Conferencing or SIP Connected Audio) and which number they dialed into and other details. Use this API to get telephone report for a specified period of time.\n\n**Scopes:** `report:read:admin`<br>\n \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>**Prerequisites:**<br>\n* Pro or higher plan."
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nTelephone report returned.<br>\nThis is only available for paid account:{accountId}.<br>\nThe requested report cannot be generated for this account because this account has not subscribed to toll-free audio conference plan.<b",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/report/telephone?type=1&query_date_type=start_time&from=1989-05-07&to=1989-05-07&page_size=30&page_number=1&next_page_token=quis officia in reprehenderit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "report",
            "telephone"
          ],
          "query": [
            {
              "key": "type",
              "value": "1"
            },
            {
              "key": "query_date_type",
              "value": "start_time"
            },
            {
              "key": "from",
              "value": "1989-05-07"
            },
            {
              "key": "to",
              "value": "1989-05-07"
            },
            {
              "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  \\\"from\\\": \\\"2019-06-20\\\",\\n  \\\"to\\\": \\\"2019-07-20\\\",\\n  \\\"page_count\\\": 1,\\n  \\\"page_number\\\": 1,\\n  \\\"page_size\\\": 30,\\n  \\\"total_records\\\": 1,\\n  \\\"telephony_usage\\\": [\\n    {\\n      \\\"meeting_id\\\": 00000,\\n      \\\"phone_number\\\": \\\"000002001\\\",\\n      \\\"host_name\\\": \\\"John Dev\\\",\\n      \\\"host_email\\\": \\\"example@example.com\\\",\\n      \\\"dept\\\": \\\"Billing\\\",\\n      \\\"start_time\\\": \\\"2019-07-15T23:24:52Z\\\",\\n      \\\"end_time\\\": \\\"2019-07-15T23:30:19Z\\\",\\n      \\\"duration\\\": 6,\\n      \\\"total\\\": 11,\\n      \\\"country_name\\\": \\\"Macau SAR\\\",\\n      \\\"meeting_type\\\": \\\"Meeting\\\",\\n      \\\"call_in_number\\\": \\\"+85123456789\\\"\\n    }\\n  ]\\n}\""
    }
  ]
}