Chilkat Online Tools

SQL Server / Zoom API / Delete a user

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

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

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'DELETE', 'reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true'
    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
        RETURN
      END

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT

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

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Response Body:'
        EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @resp

        EXEC @hr = sp_OADestroy @http
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp


    PRINT 'Success.'

    EXEC @hr = sp_OADestroy @http


END
GO

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/users/:userId?action=disassociate&transfer_email=quis officia in reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true

Postman Collection Item JSON

{
  "name": "Delete a user",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/users/:userId?action=disassociate&transfer_email=quis officia in reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "users",
        ":userId"
      ],
      "query": [
        {
          "key": "action",
          "value": "disassociate",
          "description": "Delete action options:<br>`disassociate` - Disassociate a user.<br>`delete`-  Permanently delete a user.<br>Note: To delete pending user in the account, use `disassociate`"
        },
        {
          "key": "transfer_email",
          "value": "quis officia in reprehenderit",
          "description": "Transfer email. This field is **required** if the user has upcoming Zoom Events scheduled. After you delete or disassociate the user, the user's upcoming Zoom Events will be transferred to the target user."
        },
        {
          "key": "transfer_meeting",
          "value": "true",
          "description": "Transfer meeting."
        },
        {
          "key": "transfer_webinar",
          "value": "true",
          "description": "Transfer webinar."
        },
        {
          "key": "transfer_recording",
          "value": "true",
          "description": "Transfer recording."
        }
      ],
      "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 disassociate (unlink) a user or permanently delete a 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\n**Deleting** a user **permanently** removes the user and their data from Zoom. Users can create a new Zoom account using the same email address. An account owner or an account admin can transfer meetings, webinars and cloud recordings to another Zoom user account before deleting.\n\n**Disassociating** a user unlinks the user from the associated Zoom account and provides the user their own basic free Zoom account. The disassociated user can then purchase their own Zoom licenses. An account owner or account admin can transfer the user's meetings, webinars, and cloud recordings to another user before disassociation.\n\n**Scopes:** `user:write:admin`, `user:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `204`<br>\nUser deleted.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?action=disassociate&transfer_email=quis officia in reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "action",
              "value": "disassociate"
            },
            {
              "key": "transfer_email",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "transfer_meeting",
              "value": "true"
            },
            {
              "key": "transfer_webinar",
              "value": "true"
            },
            {
              "key": "transfer_recording",
              "value": "true"
            }
          ],
          "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": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad Request** <br><br> **Error Code:** `300`<br>The transfer-to email address cannot be the same as the unlinked or deleted user’s email address.<br> Unable to unlink API user(s).<br> This user has published events on Zoom Ev",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?action=disassociate&transfer_email=quis officia in reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "action",
              "value": "disassociate"
            },
            {
              "key": "transfer_email",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "transfer_meeting",
              "value": "true"
            },
            {
              "key": "transfer_webinar",
              "value": "true"
            },
            {
              "key": "transfer_recording",
              "value": "true"
            }
          ],
          "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": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404` **Not Found**<br><br>\n**Error Code:** `1001`<br>\nUser does not exist: $userId.<br>",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?action=disassociate&transfer_email=quis officia in reprehenderit&transfer_meeting=true&transfer_webinar=true&transfer_recording=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "action",
              "value": "disassociate"
            },
            {
              "key": "transfer_email",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "transfer_meeting",
              "value": "true"
            },
            {
              "key": "transfer_webinar",
              "value": "true"
            },
            {
              "key": "transfer_recording",
              "value": "true"
            }
          ],
          "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": ""
    }
  ]
}