Chilkat Online Tools

PowerBuilder / Zoom API / Get account plan information

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_V_type
integer li_Hosts
string ls_Service_effective_date
string ls_Next_invoice_date
string ls_Status
string ls_V_Type
integer li_Hosts
string ls_Service_effective_date
string ls_Next_invoice_date
string ls_Status
string ls_Plan_zoom_roomsType
integer li_Plan_zoom_roomsHosts
string ls_Plan_zoom_roomsService_effective_date
string ls_Plan_zoom_roomsNext_invoice_date
string ls_Plan_zoom_roomsStatus
string ls_Plan_room_connectorType
integer li_Plan_room_connectorHosts
string ls_Plan_room_connectorService_effective_date
string ls_Plan_room_connectorNext_invoice_date
string ls_Plan_room_connectorStatus
string ls_Plan_recording
string ls_Plan_recording_service_effective_date
string ls_Plan_recording_next_invoice_date
string ls_Plan_recording_status
string ls_Plan_audioType
string ls_Tollfree_countries
string ls_Premium_countries
string ls_Callout_countries
integer li_Ddi_numbers
string ls_Plan_audioService_effective_date
string ls_Plan_audioNext_invoice_date
string ls_Plan_audioStatus
string ls_Plan_baseType
string ls_Plan_baseCallout_countries
string ls_Plan_baseService_effective_date
string ls_Plan_baseNext_invoice_date
string ls_Plan_baseStatus
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://api.zoom.us/v2/accounts/:accountId/plans",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

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

ls_V_Type = loo_JResp.StringOf("plan_base.type")
li_Hosts = loo_JResp.IntOf("plan_base.hosts")
ls_Service_effective_date = loo_JResp.StringOf("plan_base.service_effective_date")
ls_Next_invoice_date = loo_JResp.StringOf("plan_base.next_invoice_date")
ls_Status = loo_JResp.StringOf("plan_base.status")
ls_Plan_zoom_roomsType = loo_JResp.StringOf("plan_zoom_rooms.type")
li_Plan_zoom_roomsHosts = loo_JResp.IntOf("plan_zoom_rooms.hosts")
ls_Plan_zoom_roomsService_effective_date = loo_JResp.StringOf("plan_zoom_rooms.service_effective_date")
ls_Plan_zoom_roomsNext_invoice_date = loo_JResp.StringOf("plan_zoom_rooms.next_invoice_date")
ls_Plan_zoom_roomsStatus = loo_JResp.StringOf("plan_zoom_rooms.status")
ls_Plan_room_connectorType = loo_JResp.StringOf("plan_room_connector.type")
li_Plan_room_connectorHosts = loo_JResp.IntOf("plan_room_connector.hosts")
ls_Plan_room_connectorService_effective_date = loo_JResp.StringOf("plan_room_connector.service_effective_date")
ls_Plan_room_connectorNext_invoice_date = loo_JResp.StringOf("plan_room_connector.next_invoice_date")
ls_Plan_room_connectorStatus = loo_JResp.StringOf("plan_room_connector.status")
ls_Plan_recording = loo_JResp.StringOf("plan_recording")
ls_Plan_recording_service_effective_date = loo_JResp.StringOf("plan_recording_service_effective_date")
ls_Plan_recording_next_invoice_date = loo_JResp.StringOf("plan_recording_next_invoice_date")
ls_Plan_recording_status = loo_JResp.StringOf("plan_recording_status")
ls_Plan_audioType = loo_JResp.StringOf("plan_audio.type")
ls_Tollfree_countries = loo_JResp.StringOf("plan_audio.tollfree_countries")
ls_Premium_countries = loo_JResp.StringOf("plan_audio.premium_countries")
ls_Callout_countries = loo_JResp.StringOf("plan_audio.callout_countries")
li_Ddi_numbers = loo_JResp.IntOf("plan_audio.ddi_numbers")
ls_Plan_audioService_effective_date = loo_JResp.StringOf("plan_audio.service_effective_date")
ls_Plan_audioNext_invoice_date = loo_JResp.StringOf("plan_audio.next_invoice_date")
ls_Plan_audioStatus = loo_JResp.StringOf("plan_audio.status")
ls_Plan_baseType = loo_JResp.StringOf("plan_phone.plan_base.type")
ls_Plan_baseCallout_countries = loo_JResp.StringOf("plan_phone.plan_base.callout_countries")
ls_Plan_baseService_effective_date = loo_JResp.StringOf("plan_phone.plan_base.service_effective_date")
ls_Plan_baseNext_invoice_date = loo_JResp.StringOf("plan_phone.plan_base.next_invoice_date")
ls_Plan_baseStatus = loo_JResp.StringOf("plan_phone.plan_base.status")
i = 0
li_Count_i = loo_JResp.SizeOfArray("plan_large_meeting")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_type = loo_JResp.StringOf("plan_large_meeting[i].type")
    li_Hosts = loo_JResp.IntOf("plan_large_meeting[i].hosts")
    ls_Service_effective_date = loo_JResp.StringOf("plan_large_meeting[i].service_effective_date")
    ls_Next_invoice_date = loo_JResp.StringOf("plan_large_meeting[i].next_invoice_date")
    ls_Status = loo_JResp.StringOf("plan_large_meeting[i].status")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("plan_webinar")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_type = loo_JResp.StringOf("plan_webinar[i].type")
    li_Hosts = loo_JResp.IntOf("plan_webinar[i].hosts")
    ls_Service_effective_date = loo_JResp.StringOf("plan_webinar[i].service_effective_date")
    ls_Next_invoice_date = loo_JResp.StringOf("plan_webinar[i].next_invoice_date")
    ls_Status = loo_JResp.StringOf("plan_webinar[i].status")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("plan_zoom_events")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_type = loo_JResp.StringOf("plan_zoom_events[i].type")
    li_Hosts = loo_JResp.IntOf("plan_zoom_events[i].hosts")
    ls_Service_effective_date = loo_JResp.StringOf("plan_zoom_events[i].service_effective_date")
    ls_Next_invoice_date = loo_JResp.StringOf("plan_zoom_events[i].next_invoice_date")
    ls_Status = loo_JResp.StringOf("plan_zoom_events[i].status")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("plan_phone.plan_calling")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_type = loo_JResp.StringOf("plan_phone.plan_calling[i].type")
    li_Hosts = loo_JResp.IntOf("plan_phone.plan_calling[i].hosts")
    ls_Service_effective_date = loo_JResp.StringOf("plan_phone.plan_calling[i].service_effective_date")
    ls_Next_invoice_date = loo_JResp.StringOf("plan_phone.plan_calling[i].next_invoice_date")
    ls_Status = loo_JResp.StringOf("plan_phone.plan_calling[i].status")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("plan_phone.plan_number")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_type = loo_JResp.StringOf("plan_phone.plan_number[i].type")
    li_Hosts = loo_JResp.IntOf("plan_phone.plan_number[i].hosts")
    ls_Service_effective_date = loo_JResp.StringOf("plan_phone.plan_number[i].service_effective_date")
    ls_Next_invoice_date = loo_JResp.StringOf("plan_phone.plan_number[i].next_invoice_date")
    ls_Status = loo_JResp.StringOf("plan_phone.plan_number[i].status")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

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": ""
    }
  ]
}