Chilkat Online Tools

SQL Server / Zoom API / Get user permissions

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

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.zoom.us/v2/users/:userId/permissions', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    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 @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END

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

    -- {
    --   "permissions": [
    --     "IMGroups:Edit",
    --     "Security:Edit",
    --     "IMGroups:Read",
    --     "BillingSubscription:Edit",
    --     "SingleSignOn:Edit",
    --     "WebinarSetting:Edit",
    --     "Branding:Read",
    --     "UsageReport:Read",
    --     "BillingSubscription:Read",
    --     "CrossHybrid:Read",
    --     "UserActivitiesReport:Read",
    --     "Branding:Edit",
    --     "SingleSignOn:Read",
    --     "Security:Read",
    --     "Dashboard:Read",
    --     "AccountProfile:Read",
    --     "MarketPlace:Edit",
    --     "ZoomRooms:Edit",
    --     "PbxAdmin:Read",
    --     "Meeting:Edit",
    --     "IMChatHistory:Read",
    --     "RoomConnector:Read",
    --     "IMChatBot:Edit",
    --     "CrossHybrid:Edit",
    --     "AccountProfile:Edit",
    --     "RoomConnector:Edit",
    --     "Group:Edit",
    --     "BillingInformation:Edit",
    --     "LyncConnector:Edit",
    --     "LyncConnector:Read",
    --     "Integration:Read",
    --     "User:Edit",
    --     "BillingInformation:Read",
    --     "AccountSetting:Edit",
    --     "SubAccount:Read",
    --     "IMSetting:Read",
    --     "MeetingConnector:Read",
    --     "ThirdPartyConference:Read",
    --     "Meeting:Join",
    --     "CallInContacts:Read",
    --     "ZoomDevelopers:Read",
    --     "Recording:Read",
    --     "Role:Edit",
    --     "Recording:Edit",
    --     "DigitalSignage:Read",
    --     "ScheduleTrackingFields:Read",
    --     "ThirdPartyConference:Edit",
    --     "Group:Read",
    --     "AccountSetting:Read",
    --     "MeetingConnector:Edit",
    --     "Integration:Edit",
    --     "CallInContacts:Edit",
    --     "DigitalSignage:Edit",
    --     "MarketPlace:Read",
    --     "PbxAdmin:Edit",
    --     "ZoomRooms:Read",
    --     "MobileDeviceManagement:Read",
    --     "RecordingContent:Read",
    --     "User:Read",
    --     "ScheduleTrackingFields:Edit",
    --     "WebinarSetting:Read"
    --   ]
    -- }

    -- 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 @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'permissions'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'permissions[i]'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/users/:userId/permissions

Postman Collection Item JSON

{
  "name": "Get user permissions",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/users/:userId/permissions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "users",
        ":userId",
        "permissions"
      ],
      "variable": [
        {
          "key": "userId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
        }
      ]
    },
    "description": "Use this API to get permissions that have been granted to the user. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.\n\nUsers can be assigned a set of permissions that allows them to access only the pages/information that a user needs to view or edit.\n\n**Scopes:** `user:read:admin`, `user:read`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nUser permissions returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId/permissions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "permissions"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"permissions\": [\n  \"IMGroups:Edit\",\n  \"Security:Edit\",\n  \"IMGroups:Read\",\n  \"BillingSubscription:Edit\",\n  \"SingleSignOn:Edit\",\n  \"WebinarSetting:Edit\",\n  \"Branding:Read\",\n  \"UsageReport:Read\",\n  \"BillingSubscription:Read\",\n  \"CrossHybrid:Read\",\n  \"UserActivitiesReport:Read\",\n  \"Branding:Edit\",\n  \"SingleSignOn:Read\",\n  \"Security:Read\",\n  \"Dashboard:Read\",\n  \"AccountProfile:Read\",\n  \"MarketPlace:Edit\",\n  \"ZoomRooms:Edit\",\n  \"PbxAdmin:Read\",\n  \"Meeting:Edit\",\n  \"IMChatHistory:Read\",\n  \"RoomConnector:Read\",\n  \"IMChatBot:Edit\",\n  \"CrossHybrid:Edit\",\n  \"AccountProfile:Edit\",\n  \"RoomConnector:Edit\",\n  \"Group:Edit\",\n  \"BillingInformation:Edit\",\n  \"LyncConnector:Edit\",\n  \"LyncConnector:Read\",\n  \"Integration:Read\",\n  \"User:Edit\",\n  \"BillingInformation:Read\",\n  \"AccountSetting:Edit\",\n  \"SubAccount:Read\",\n  \"IMSetting:Read\",\n  \"MeetingConnector:Read\",\n  \"ThirdPartyConference:Read\",\n  \"Meeting:Join\",\n  \"CallInContacts:Read\",\n  \"ZoomDevelopers:Read\",\n  \"Recording:Read\",\n  \"Role:Edit\",\n  \"Recording:Edit\",\n  \"DigitalSignage:Read\",\n  \"ScheduleTrackingFields:Read\",\n  \"ThirdPartyConference:Edit\",\n  \"Group:Read\",\n  \"AccountSetting:Read\",\n  \"MeetingConnector:Edit\",\n  \"Integration:Edit\",\n  \"CallInContacts:Edit\",\n  \"DigitalSignage:Edit\",\n  \"MarketPlace:Read\",\n  \"PbxAdmin:Edit\",\n  \"ZoomRooms:Read\",\n  \"MobileDeviceManagement:Read\",\n  \"RecordingContent:Read\",\n  \"User:Read\",\n  \"ScheduleTrackingFields:Edit\",\n  \"WebinarSetting:Read\"\n ]\n}"
    },
    {
      "name": "**HTTP Status Code:** `404` **Not Found**<br><br>\n**Error Code:** `1001`<br>\nUser does not exist: $userId.\n",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId/permissions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "permissions"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}