Chilkat Online Tools

SQL Server / Zoom API / Cancel additional plans

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 @req int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.HttpRequest', @req OUT

    EXEC sp_OASetProperty @req, 'HttpVerb', 'PATCH'
    EXEC sp_OASetProperty @req, 'Path', '/v2/accounts/:accountId/plans/addons/status'
    EXEC sp_OASetProperty @req, 'ContentType', 'multipart/form-data'
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'action', 'cancel'

    EXEC sp_OAMethod @req, 'AddParam', NULL, '', ''

    EXEC sp_OAMethod @req, 'AddParam', NULL, 'reason', 'cancelcupidatat nisi3'

    EXEC sp_OAMethod @req, 'AddParam', NULL, 'comment', 'cancelcupidatat nisi3ea est'

    EXEC sp_OAMethod @req, 'AddHeader', NULL, 'Authorization', 'Bearer <access_token>'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'SynchronousRequest', @resp OUT, 'api.zoom.us', 443, 1, @req
    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 @req
        RETURN
      END

    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT @iTmp0
    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    PRINT @sTmp0
    EXEC @hr = sp_OADestroy @resp


    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @req


END
GO

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'action=cancel'
	--form 'type=cancelcupidatat nisi'
	--form 'reason=cancelcupidatat nisi3'
	--form 'comment=cancelcupidatat nisi3ea est'
https://api.zoom.us/v2/accounts/:accountId/plans/addons/status

Postman Collection Item JSON

{
  "name": "Cancel additional plans",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "action",
          "value": "cancel",
          "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
          "type": "text"
        },
        {
          "key": "type",
          "value": "cupidatat nisi",
          "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
          "type": "text"
        },
        {
          "key": "reason",
          "value": "3",
          "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
          "type": "text"
        },
        {
          "key": "comment",
          "value": "ea est",
          "description": "Additional comments about the cancellation decision.",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "accounts",
        ":accountId",
        "plans",
        "addons",
        "status"
      ],
      "variable": [
        {
          "key": "accountId"
        }
      ]
    },
    "description": "[Cancel additional plan](https://support.zoom.us/hc/en-us/articles/203634215-How-Do-I-Cancel-My-Subscription-) of a sub account. The cancellation does not provide refund for the current subscription. The service remains active for the current session.\n\nThis API can only be used by master accounts that pay all billing charges of their associated Pro or higher sub accounts. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' subscriptions. Email the partner programs team at **partner-success@zoom.us** for more details.<br><br>\n\n**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>\n\n**Prerequisites:**<br>\n* Pro or a higher plan with master account option enabled.\n* The sub account must be a paid account.<br>\n**Scope:** `billing:master`<br>\n "
  },
  "response": [
    {
      "name": "**Error Code:** `200`<br>\nYou cannot cancel plan for a sub account that is under a free plan.<br>\nYou cannot perform this action because you do not have a Zoom Phone subscription for this account.<br>\nFree trial and VIP accounts can not cancel plans of a ",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "action",
              "value": "cancel",
              "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
              "type": "text"
            },
            {
              "key": "type",
              "value": "cupidatat nisi",
              "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
              "type": "text"
            },
            {
              "key": "reason",
              "value": "3",
              "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
              "type": "text"
            },
            {
              "key": "comment",
              "value": "ea est",
              "description": "Additional comments about the cancellation decision.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "plans",
            "addons",
            "status"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `204`<br>\nPlan cancelled successfully. ",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "action",
              "value": "cancel",
              "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
              "type": "text"
            },
            {
              "key": "type",
              "value": "cupidatat nisi",
              "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
              "type": "text"
            },
            {
              "key": "reason",
              "value": "3",
              "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
              "type": "text"
            },
            {
              "key": "comment",
              "value": "ea est",
              "description": "Additional comments about the cancellation decision.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "plans",
            "addons",
            "status"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "**Error Code:** `300`<br>\nPlan type is required.",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "action",
              "value": "cancel",
              "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
              "type": "text"
            },
            {
              "key": "type",
              "value": "cupidatat nisi",
              "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
              "type": "text"
            },
            {
              "key": "reason",
              "value": "3",
              "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
              "type": "text"
            },
            {
              "key": "comment",
              "value": "ea est",
              "description": "Additional comments about the cancellation decision.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "plans",
            "addons",
            "status"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "Multiple Choices",
      "code": 300,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `400`<br> \n**Error Code:** `2100`<br>\nThis sub account is on self pay mode.<br>\nYou cannot make cancellation requests for a bundle plan. Contact the Zoom Support team for details.<br>\nMaster accounts with bulk licenses cannot provisi",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "action",
              "value": "cancel",
              "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
              "type": "text"
            },
            {
              "key": "type",
              "value": "cupidatat nisi",
              "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
              "type": "text"
            },
            {
              "key": "reason",
              "value": "3",
              "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
              "type": "text"
            },
            {
              "key": "comment",
              "value": "ea est",
              "description": "Additional comments about the cancellation decision.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "plans",
            "addons",
            "status"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\n**Error Code:** `1001`<br>\nUser does not exist.<br>\n**Error Code:** `2001`<br> \nAccount does not exist: {subAccountId}.\n\n",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "action",
              "value": "cancel",
              "description": "The action that needs to be taken for this sub account. Value must be set to \"cancel\". (This can only be one of cancel)",
              "type": "text"
            },
            {
              "key": "type",
              "value": "cupidatat nisi",
              "description": "Plan [type](https://marketplace.zoom.us/docs/api-reference/other-references/plans).",
              "type": "text"
            },
            {
              "key": "reason",
              "value": "3",
              "description": "The reason for the cancellation of plan. Reason options:<br>`1` - I am no longer working remote.<br>`2` - I had challenges getting the support I needed.<br>`3` - Features in the Basic Free Plan are sufficient.<br>`4` - The expense is too high.<br>`5` - I purchased the wrong product.<br> `6` - Paid purchase not needed right now, will repurchase in the future. (This can only be one of 1,2,3,4,5,6)",
              "type": "text"
            },
            {
              "key": "comment",
              "value": "ea est",
              "description": "Additional comments about the cancellation decision.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/plans/addons/status",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "plans",
            "addons",
            "status"
          ],
          "variable": [
            {
              "key": "accountId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}