Chilkat Online Tools

DataFlex / Zoom API / Get account plan information

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sV_type
    Integer iHosts
    String sService_effective_date
    String sNext_invoice_date
    String sStatus
    String sV_Type
    Integer iHosts
    String sService_effective_date
    String sNext_invoice_date
    String sStatus
    String sPlan_zoom_roomsType
    Integer iPlan_zoom_roomsHosts
    String sPlan_zoom_roomsService_effective_date
    String sPlan_zoom_roomsNext_invoice_date
    String sPlan_zoom_roomsStatus
    String sPlan_room_connectorType
    Integer iPlan_room_connectorHosts
    String sPlan_room_connectorService_effective_date
    String sPlan_room_connectorNext_invoice_date
    String sPlan_room_connectorStatus
    String sPlan_recording
    String sPlan_recording_service_effective_date
    String sPlan_recording_next_invoice_date
    String sPlan_recording_status
    String sPlan_audioType
    String sTollfree_countries
    String sPremium_countries
    String sCallout_countries
    Integer iDdi_numbers
    String sPlan_audioService_effective_date
    String sPlan_audioNext_invoice_date
    String sPlan_audioStatus
    String sPlan_baseType
    String sPlan_baseCallout_countries
    String sPlan_baseService_effective_date
    String sPlan_baseNext_invoice_date
    String sPlan_baseStatus
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.zoom.us/v2/accounts/:accountId/plans" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_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

    Get ComStringOf Of hoJResp "plan_base.type" To sV_Type
    Get ComIntOf Of hoJResp "plan_base.hosts" To iHosts
    Get ComStringOf Of hoJResp "plan_base.service_effective_date" To sService_effective_date
    Get ComStringOf Of hoJResp "plan_base.next_invoice_date" To sNext_invoice_date
    Get ComStringOf Of hoJResp "plan_base.status" To sStatus
    Get ComStringOf Of hoJResp "plan_zoom_rooms.type" To sPlan_zoom_roomsType
    Get ComIntOf Of hoJResp "plan_zoom_rooms.hosts" To iPlan_zoom_roomsHosts
    Get ComStringOf Of hoJResp "plan_zoom_rooms.service_effective_date" To sPlan_zoom_roomsService_effective_date
    Get ComStringOf Of hoJResp "plan_zoom_rooms.next_invoice_date" To sPlan_zoom_roomsNext_invoice_date
    Get ComStringOf Of hoJResp "plan_zoom_rooms.status" To sPlan_zoom_roomsStatus
    Get ComStringOf Of hoJResp "plan_room_connector.type" To sPlan_room_connectorType
    Get ComIntOf Of hoJResp "plan_room_connector.hosts" To iPlan_room_connectorHosts
    Get ComStringOf Of hoJResp "plan_room_connector.service_effective_date" To sPlan_room_connectorService_effective_date
    Get ComStringOf Of hoJResp "plan_room_connector.next_invoice_date" To sPlan_room_connectorNext_invoice_date
    Get ComStringOf Of hoJResp "plan_room_connector.status" To sPlan_room_connectorStatus
    Get ComStringOf Of hoJResp "plan_recording" To sPlan_recording
    Get ComStringOf Of hoJResp "plan_recording_service_effective_date" To sPlan_recording_service_effective_date
    Get ComStringOf Of hoJResp "plan_recording_next_invoice_date" To sPlan_recording_next_invoice_date
    Get ComStringOf Of hoJResp "plan_recording_status" To sPlan_recording_status
    Get ComStringOf Of hoJResp "plan_audio.type" To sPlan_audioType
    Get ComStringOf Of hoJResp "plan_audio.tollfree_countries" To sTollfree_countries
    Get ComStringOf Of hoJResp "plan_audio.premium_countries" To sPremium_countries
    Get ComStringOf Of hoJResp "plan_audio.callout_countries" To sCallout_countries
    Get ComIntOf Of hoJResp "plan_audio.ddi_numbers" To iDdi_numbers
    Get ComStringOf Of hoJResp "plan_audio.service_effective_date" To sPlan_audioService_effective_date
    Get ComStringOf Of hoJResp "plan_audio.next_invoice_date" To sPlan_audioNext_invoice_date
    Get ComStringOf Of hoJResp "plan_audio.status" To sPlan_audioStatus
    Get ComStringOf Of hoJResp "plan_phone.plan_base.type" To sPlan_baseType
    Get ComStringOf Of hoJResp "plan_phone.plan_base.callout_countries" To sPlan_baseCallout_countries
    Get ComStringOf Of hoJResp "plan_phone.plan_base.service_effective_date" To sPlan_baseService_effective_date
    Get ComStringOf Of hoJResp "plan_phone.plan_base.next_invoice_date" To sPlan_baseNext_invoice_date
    Get ComStringOf Of hoJResp "plan_phone.plan_base.status" To sPlan_baseStatus
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "plan_large_meeting" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "plan_large_meeting[i].type" To sV_type
        Get ComIntOf Of hoJResp "plan_large_meeting[i].hosts" To iHosts
        Get ComStringOf Of hoJResp "plan_large_meeting[i].service_effective_date" To sService_effective_date
        Get ComStringOf Of hoJResp "plan_large_meeting[i].next_invoice_date" To sNext_invoice_date
        Get ComStringOf Of hoJResp "plan_large_meeting[i].status" To sStatus
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "plan_webinar" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "plan_webinar[i].type" To sV_type
        Get ComIntOf Of hoJResp "plan_webinar[i].hosts" To iHosts
        Get ComStringOf Of hoJResp "plan_webinar[i].service_effective_date" To sService_effective_date
        Get ComStringOf Of hoJResp "plan_webinar[i].next_invoice_date" To sNext_invoice_date
        Get ComStringOf Of hoJResp "plan_webinar[i].status" To sStatus
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "plan_zoom_events" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "plan_zoom_events[i].type" To sV_type
        Get ComIntOf Of hoJResp "plan_zoom_events[i].hosts" To iHosts
        Get ComStringOf Of hoJResp "plan_zoom_events[i].service_effective_date" To sService_effective_date
        Get ComStringOf Of hoJResp "plan_zoom_events[i].next_invoice_date" To sNext_invoice_date
        Get ComStringOf Of hoJResp "plan_zoom_events[i].status" To sStatus
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "plan_phone.plan_calling" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "plan_phone.plan_calling[i].type" To sV_type
        Get ComIntOf Of hoJResp "plan_phone.plan_calling[i].hosts" To iHosts
        Get ComStringOf Of hoJResp "plan_phone.plan_calling[i].service_effective_date" To sService_effective_date
        Get ComStringOf Of hoJResp "plan_phone.plan_calling[i].next_invoice_date" To sNext_invoice_date
        Get ComStringOf Of hoJResp "plan_phone.plan_calling[i].status" To sStatus
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "plan_phone.plan_number" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "plan_phone.plan_number[i].type" To sV_type
        Get ComIntOf Of hoJResp "plan_phone.plan_number[i].hosts" To iHosts
        Get ComStringOf Of hoJResp "plan_phone.plan_number[i].service_effective_date" To sService_effective_date
        Get ComStringOf Of hoJResp "plan_phone.plan_number[i].next_invoice_date" To sNext_invoice_date
        Get ComStringOf Of hoJResp "plan_phone.plan_number[i].status" To sStatus
        Move (i + 1) To i
    Loop



End_Procedure

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