Chilkat Online Tools

unicodeC / Zoom API / Get sub account details

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkStringBuilderW sbResponseBody;
    HCkJsonObjectW jResp;
    int respStatusCode;
    const wchar_t *id;
    const wchar_t *owner_id;
    const wchar_t *owner_email;
    const wchar_t *created_at;
    const wchar_t *Share_rc;
    const wchar_t *Room_connectors;
    const wchar_t *Share_mc;
    const wchar_t *Meeting_connectors;
    const wchar_t *Pay_mode;

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

    http = CkHttpW_Create();

    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttpW_putAuthToken(http,L"<access_token>");

    sbResponseBody = CkStringBuilderW_Create();
    success = CkHttpW_QuickGetSb(http,L"https://api.zoom.us/v2/accounts/:accountId",sbResponseBody);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkStringBuilderW_Dispose(sbResponseBody);
        return;
    }

    jResp = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(jResp,sbResponseBody);
    CkJsonObjectW_putEmitCompact(jResp,FALSE);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",CkJsonObjectW_emit(jResp));

    respStatusCode = CkHttpW_getLastStatus(http);
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",CkHttpW_lastHeader(http));
        wprintf(L"Failed.\n");
        CkHttpW_Dispose(http);
        CkStringBuilderW_Dispose(sbResponseBody);
        CkJsonObjectW_Dispose(jResp);
        return;
    }

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

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    id = CkJsonObjectW_stringOf(jResp,L"id");
    owner_id = CkJsonObjectW_stringOf(jResp,L"owner_id");
    owner_email = CkJsonObjectW_stringOf(jResp,L"owner_email");
    created_at = CkJsonObjectW_stringOf(jResp,L"created_at");
    Share_rc = CkJsonObjectW_stringOf(jResp,L"options.share_rc");
    Room_connectors = CkJsonObjectW_stringOf(jResp,L"options.room_connectors");
    Share_mc = CkJsonObjectW_stringOf(jResp,L"options.share_mc");
    Meeting_connectors = CkJsonObjectW_stringOf(jResp,L"options.meeting_connectors");
    Pay_mode = CkJsonObjectW_stringOf(jResp,L"options.pay_mode");


    CkHttpW_Dispose(http);
    CkStringBuilderW_Dispose(sbResponseBody);
    CkJsonObjectW_Dispose(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": ""
    }
  ]
}