Chilkat Online Tools

PowerBuilder / Zoom API / Get sub account details

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_Owner_id
string ls_Owner_email
string ls_Created_at
string ls_Share_rc
string ls_Room_connectors
string ls_Share_mc
string ls_Meeting_connectors
string ls_Pay_mode

// 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",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)

// {
//   "id": "string",
//   "owner_id": "string",
//   "owner_email": "string",
//   "created_at": "string [date-time]",
//   "options": {
//     "share_rc": "boolean",
//     "room_connectors": "string",
//     "share_mc": "boolean",
//     "meeting_connectors": "string",
//     "pay_mode": "string"
//   }
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_Id = loo_JResp.StringOf("id")
ls_Owner_id = loo_JResp.StringOf("owner_id")
ls_Owner_email = loo_JResp.StringOf("owner_email")
ls_Created_at = loo_JResp.StringOf("created_at")
ls_Share_rc = loo_JResp.StringOf("options.share_rc")
ls_Room_connectors = loo_JResp.StringOf("options.room_connectors")
ls_Share_mc = loo_JResp.StringOf("options.share_mc")
ls_Meeting_connectors = loo_JResp.StringOf("options.meeting_connectors")
ls_Pay_mode = loo_JResp.StringOf("options.pay_mode")


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

Postman Collection Item JSON

{
  "name": "Get sub account details",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/accounts/:accountId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "accounts",
        ":accountId"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The account's ID."
        }
      ]
    },
    "description": "Use this API to get information about Master account's sub account. \n\n Your account must be a Master account in order to return sub account information. Zoom allows only approved partners to use [Master account APIs](https://marketplace.zoom.us/docs/api-reference/master-account-apis) and create sub accounts. For information about partner programs, email the partners team at [partner-success@zoom.us](mailto:partner-success@zoom.us). \n\n**Scopes:** `account:read:admin` <br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light` \n\n**Prerequisites:** \n* A Pro or a higher paid account with the Master account option enabled."
  },
  "response": [
    {
      "name": "**HTTP Status Code**: `200`<br>\nAccount object returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId"
          ],
          "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 \"id\": \"string\",\n \"owner_id\": \"string\",\n \"owner_email\": \"string\",\n \"created_at\": \"string [date-time]\",\n \"options\": {\n  \"share_rc\": \"boolean\",\n  \"room_connectors\": \"string\",\n  \"share_mc\": \"boolean\",\n  \"meeting_connectors\": \"string\",\n  \"pay_mode\": \"string\"\n }\n}"
    },
    {
      "name": "**HTTP Status Code**: `404`<br>\n**Error Code:** `2001`<br> Account 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",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId"
          ],
          "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": ""
    }
  ]
}