SQL Server / Zoom API / Get account plan information
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
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.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
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.zoom.us/v2/accounts/:accountId/plans', @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
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.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)
-- {
-- "plan_base": {
-- "type": "monthly",
-- "hosts": 100,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- },
-- "plan_zoom_rooms": {
-- "type": "zroom_monthly",
-- "hosts": 50,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- },
-- "plan_room_connector": {
-- "type": "roomconnector_monthly",
-- "hosts": 10,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- },
-- "plan_large_meeting": [
-- {
-- "type": "plan_large500_two_years",
-- "hosts": 10,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- }
-- ],
-- "plan_webinar": [
-- {
-- "type": "webinar500_monthly",
-- "hosts": 10,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- }
-- ],
-- "plan_zoom_events": [
-- {
-- "type": "zoomevents500_monthly",
-- "hosts": 20,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- }
-- ],
-- "plan_recording": "cmr_monthly_commitment_40",
-- "plan_recording_service_effective_date": "2021-09-07T00:00:00Z",
-- "plan_recording_next_invoice_date": "2021-10-07T00:00:00Z",
-- "plan_recording_status": "status",
-- "plan_audio": {
-- "type": "tollfree_payongo",
-- "tollfree_countries": "US",
-- "premium_countries": "",
-- "callout_countries": "",
-- "ddi_numbers": 0,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- },
-- "plan_phone": {
-- "plan_base": {
-- "type": "phone_payongo",
-- "callout_countries": "",
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- },
-- "plan_calling": [
-- {
-- "type": "phone_calling_usca_monthly_unlimited",
-- "hosts": 5,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- }
-- ],
-- "plan_number": [
-- {
-- "type": "phone_number_usca_monthly",
-- "hosts": 5,
-- "service_effective_date": "2021-09-07T00:00:00Z",
-- "next_invoice_date": "2021-10-07T00:00:00Z",
-- "status": "active"
-- }
-- ]
-- }
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @v_type nvarchar(4000)
DECLARE @hosts int
DECLARE @service_effective_date nvarchar(4000)
DECLARE @next_invoice_date nvarchar(4000)
DECLARE @status nvarchar(4000)
DECLARE @v_Type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'plan_base.type'
DECLARE @Hosts int
EXEC sp_OAMethod @jResp, 'IntOf', @Hosts OUT, 'plan_base.hosts'
DECLARE @Service_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Service_effective_date OUT, 'plan_base.service_effective_date'
DECLARE @Next_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Next_invoice_date OUT, 'plan_base.next_invoice_date'
DECLARE @Status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'plan_base.status'
DECLARE @plan_zoom_roomsType nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_zoom_roomsType OUT, 'plan_zoom_rooms.type'
DECLARE @plan_zoom_roomsHosts int
EXEC sp_OAMethod @jResp, 'IntOf', @plan_zoom_roomsHosts OUT, 'plan_zoom_rooms.hosts'
DECLARE @plan_zoom_roomsService_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_zoom_roomsService_effective_date OUT, 'plan_zoom_rooms.service_effective_date'
DECLARE @plan_zoom_roomsNext_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_zoom_roomsNext_invoice_date OUT, 'plan_zoom_rooms.next_invoice_date'
DECLARE @plan_zoom_roomsStatus nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_zoom_roomsStatus OUT, 'plan_zoom_rooms.status'
DECLARE @plan_room_connectorType nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_room_connectorType OUT, 'plan_room_connector.type'
DECLARE @plan_room_connectorHosts int
EXEC sp_OAMethod @jResp, 'IntOf', @plan_room_connectorHosts OUT, 'plan_room_connector.hosts'
DECLARE @plan_room_connectorService_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_room_connectorService_effective_date OUT, 'plan_room_connector.service_effective_date'
DECLARE @plan_room_connectorNext_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_room_connectorNext_invoice_date OUT, 'plan_room_connector.next_invoice_date'
DECLARE @plan_room_connectorStatus nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_room_connectorStatus OUT, 'plan_room_connector.status'
DECLARE @plan_recording nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_recording OUT, 'plan_recording'
DECLARE @plan_recording_service_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_recording_service_effective_date OUT, 'plan_recording_service_effective_date'
DECLARE @plan_recording_next_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_recording_next_invoice_date OUT, 'plan_recording_next_invoice_date'
DECLARE @plan_recording_status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_recording_status OUT, 'plan_recording_status'
DECLARE @plan_audioType nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_audioType OUT, 'plan_audio.type'
DECLARE @Tollfree_countries nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Tollfree_countries OUT, 'plan_audio.tollfree_countries'
DECLARE @Premium_countries nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Premium_countries OUT, 'plan_audio.premium_countries'
DECLARE @Callout_countries nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Callout_countries OUT, 'plan_audio.callout_countries'
DECLARE @Ddi_numbers int
EXEC sp_OAMethod @jResp, 'IntOf', @Ddi_numbers OUT, 'plan_audio.ddi_numbers'
DECLARE @plan_audioService_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_audioService_effective_date OUT, 'plan_audio.service_effective_date'
DECLARE @plan_audioNext_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_audioNext_invoice_date OUT, 'plan_audio.next_invoice_date'
DECLARE @plan_audioStatus nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @plan_audioStatus OUT, 'plan_audio.status'
DECLARE @Plan_baseType nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Plan_baseType OUT, 'plan_phone.plan_base.type'
DECLARE @Plan_baseCallout_countries nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Plan_baseCallout_countries OUT, 'plan_phone.plan_base.callout_countries'
DECLARE @Plan_baseService_effective_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Plan_baseService_effective_date OUT, 'plan_phone.plan_base.service_effective_date'
DECLARE @Plan_baseNext_invoice_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Plan_baseNext_invoice_date OUT, 'plan_phone.plan_base.next_invoice_date'
DECLARE @Plan_baseStatus nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Plan_baseStatus OUT, 'plan_phone.plan_base.status'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'plan_large_meeting'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'plan_large_meeting[i].type'
EXEC sp_OAMethod @jResp, 'IntOf', @hosts OUT, 'plan_large_meeting[i].hosts'
EXEC sp_OAMethod @jResp, 'StringOf', @service_effective_date OUT, 'plan_large_meeting[i].service_effective_date'
EXEC sp_OAMethod @jResp, 'StringOf', @next_invoice_date OUT, 'plan_large_meeting[i].next_invoice_date'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'plan_large_meeting[i].status'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'plan_webinar'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'plan_webinar[i].type'
EXEC sp_OAMethod @jResp, 'IntOf', @hosts OUT, 'plan_webinar[i].hosts'
EXEC sp_OAMethod @jResp, 'StringOf', @service_effective_date OUT, 'plan_webinar[i].service_effective_date'
EXEC sp_OAMethod @jResp, 'StringOf', @next_invoice_date OUT, 'plan_webinar[i].next_invoice_date'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'plan_webinar[i].status'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'plan_zoom_events'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'plan_zoom_events[i].type'
EXEC sp_OAMethod @jResp, 'IntOf', @hosts OUT, 'plan_zoom_events[i].hosts'
EXEC sp_OAMethod @jResp, 'StringOf', @service_effective_date OUT, 'plan_zoom_events[i].service_effective_date'
EXEC sp_OAMethod @jResp, 'StringOf', @next_invoice_date OUT, 'plan_zoom_events[i].next_invoice_date'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'plan_zoom_events[i].status'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'plan_phone.plan_calling'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'plan_phone.plan_calling[i].type'
EXEC sp_OAMethod @jResp, 'IntOf', @hosts OUT, 'plan_phone.plan_calling[i].hosts'
EXEC sp_OAMethod @jResp, 'StringOf', @service_effective_date OUT, 'plan_phone.plan_calling[i].service_effective_date'
EXEC sp_OAMethod @jResp, 'StringOf', @next_invoice_date OUT, 'plan_phone.plan_calling[i].next_invoice_date'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'plan_phone.plan_calling[i].status'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'plan_phone.plan_number'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'plan_phone.plan_number[i].type'
EXEC sp_OAMethod @jResp, 'IntOf', @hosts OUT, 'plan_phone.plan_number[i].hosts'
EXEC sp_OAMethod @jResp, 'StringOf', @service_effective_date OUT, 'plan_phone.plan_number[i].service_effective_date'
EXEC sp_OAMethod @jResp, 'StringOf', @next_invoice_date OUT, 'plan_phone.plan_number[i].next_invoice_date'
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'plan_phone.plan_number[i].status'
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/accounts/:accountId/plans
Postman Collection Item JSON
{
"name": "Get account plan information",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/accounts/:accountId/plans",
"host": [
"{{baseUrl}}"
],
"path": [
"accounts",
":accountId",
"plans"
],
"variable": [
{
"key": "accountId",
"value": "quis officia in reprehenderit",
"description": "(Required) The account's ID."
}
]
},
"description": "Use this API to return plan information of a subaccount that is managed by a Master account. \n\n This API can only be used by Master accounts that pay all billing charges of their associated Pro or higher subaccounts. Zoom only allows approved partners to use [Master APIs](https://marketplace.zoom.us/docs/api-reference/master-account-apis) and manage subaccounts' billing information. Email the partner programs team at [**partner-success@zoom.us**](mailto:partner-success@zoom.us) for more details. \n\n **Scopes:** `billing:master`, `billing:read:admin` <br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
},
"response": [
{
"name": "**HTTP Status Code:**`200`<br>\nAccount's plans returned.\n",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/accounts/:accountId/plans",
"host": [
"{{baseUrl}}"
],
"path": [
"accounts",
":accountId",
"plans"
],
"variable": [
{
"key": "accountId",
"value": "quis officia in reprehenderit",
"description": "(Required) The account's ID."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"plan_base\": {\n \"type\": \"monthly\",\n \"hosts\": 100,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n },\n \"plan_zoom_rooms\": {\n \"type\": \"zroom_monthly\",\n \"hosts\": 50,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n },\n \"plan_room_connector\": {\n \"type\": \"roomconnector_monthly\",\n \"hosts\": 10,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n },\n \"plan_large_meeting\": [\n {\n \"type\": \"plan_large500_two_years\",\n \"hosts\": 10,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n }\n ],\n \"plan_webinar\": [\n {\n \"type\": \"webinar500_monthly\",\n \"hosts\": 10,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n }\n ],\n \"plan_zoom_events\": [\n {\n \"type\": \"zoomevents500_monthly\",\n \"hosts\": 20,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n }\n ],\n \"plan_recording\": \"cmr_monthly_commitment_40\",\n \"plan_recording_service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"plan_recording_next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"plan_recording_status\": \"status\",\n \"plan_audio\": {\n \"type\": \"tollfree_payongo\",\n \"tollfree_countries\": \"US\",\n \"premium_countries\": \"\",\n \"callout_countries\": \"\",\n \"ddi_numbers\": 0,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n },\n \"plan_phone\": {\n \"plan_base\": {\n \"type\": \"phone_payongo\",\n \"callout_countries\": \"\",\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n },\n \"plan_calling\": [\n {\n \"type\": \"phone_calling_usca_monthly_unlimited\",\n \"hosts\": 5,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n }\n ],\n \"plan_number\": [\n {\n \"type\": \"phone_number_usca_monthly\",\n \"hosts\": 5,\n \"service_effective_date\": \"2021-09-07T00:00:00Z\",\n \"next_invoice_date\": \"2021-10-07T00:00:00Z\",\n \"status\": \"active\"\n }\n ]\n }\n}"
},
{
"name": "**HTTP Status Code:** `400`<br>\n**Error Code:** `2100`<br> \nThis sub account is on self pay mode.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/accounts/:accountId/plans",
"host": [
"{{baseUrl}}"
],
"path": [
"accounts",
":accountId",
"plans"
],
"variable": [
{
"key": "accountId",
"value": "quis officia in reprehenderit",
"description": "(Required) The account's ID."
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:**`404`<br>\nAccount does not exist: {subAccountId}.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/accounts/:accountId/plans",
"host": [
"{{baseUrl}}"
],
"path": [
"accounts",
":accountId",
"plans"
],
"variable": [
{
"key": "accountId",
"value": "quis officia in reprehenderit",
"description": "(Required) The account's ID."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}