Chilkat Online Tools

C / Zoom API / Get a channel

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;
    const char *id;
    const char *jid;
    const char *name;
    int v_type;
    BOOL New_members_can_see_previous_messages_files;
    int Allow_to_add_external_users;
    int Posting_permissions;

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

    http = CkHttp_Create();

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

    sbResponseBody = CkStringBuilder_Create();
    success = CkHttp_QuickGetSb(http,"https://api.zoom.us/v2/chat/channels/:channelId",sbResponseBody);
    if (success == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);

    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));

    respStatusCode = CkHttp_getLastStatus(http);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttp_lastHeader(http));
        printf("Failed.\n");
        CkHttp_Dispose(http);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "id": "cabc1234567defghijkl01234",
    //   "jid": "cabc1234567defghijkl01234@conference.xmpp.zoom.us",
    //   "name": "common2",
    //   "type": 5,
    //   "channel_settings": {
    //     "new_members_can_see_previous_messages_files": true,
    //     "allow_to_add_external_users": 1,
    //     "posting_permissions": 1
    //   }
    // }

    // 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 = CkJsonObject_stringOf(jResp,"id");
    jid = CkJsonObject_stringOf(jResp,"jid");
    name = CkJsonObject_stringOf(jResp,"name");
    v_type = CkJsonObject_IntOf(jResp,"type");
    New_members_can_see_previous_messages_files = CkJsonObject_BoolOf(jResp,"channel_settings.new_members_can_see_previous_messages_files");
    Allow_to_add_external_users = CkJsonObject_IntOf(jResp,"channel_settings.allow_to_add_external_users");
    Posting_permissions = CkJsonObject_IntOf(jResp,"channel_settings.posting_permissions");


    CkHttp_Dispose(http);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/chat/channels/:channelId

Postman Collection Item JSON

{
  "name": "Get a channel",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/chat/channels/:channelId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "chat",
        "channels",
        ":channelId"
      ],
      "variable": [
        {
          "key": "channelId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) Channel ID: Unique Identifier of a channel."
        }
      ]
    },
    "description": "Zoom chat [channels](https://support.zoom.us/hc/en-us/articles/200912909-Getting-Started-With-Channels-Group-Messaging-) allow users to communicate via chat in private or public groups. Use this API to get information about a specific channel. \n\n**Scope:** `chat_channel:read`\t<br>\n**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`\n\n<p style=\"background-color:#e1f5fe; color:#000000; padding:8px\"> <b>Note: </b> This API supports only <b>user-managed</b> <a href=\"https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-oauth-app\">OAuth apps</a>. If you use an Account-Level OAuth Access token, you can only retrieve the channel information for the authorized user. You can't retrieve the channel information of other account users. Use the <a href=\"https://marketplace.zoom.us/docs/api-reference/zoom-api/chat-channels-account-level/getchannel\">Account-Level Get Channel Info API</a> to retrieve the channel information of other account users.</p><br>\n\n\n "
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nChannel returned.<br>\n\n\n\n",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/chat/channels/:channelId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "chat",
            "channels",
            ":channelId"
          ],
          "variable": [
            {
              "key": "channelId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Channel ID: Unique Identifier of a channel."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"id\": \"cabc1234567defghijkl01234\",\n \"jid\": \"cabc1234567defghijkl01234@conference.xmpp.zoom.us\",\n \"name\": \"common2\",\n \"type\": 5,\n \"channel_settings\": {\n  \"new_members_can_see_previous_messages_files\": true,\n  \"allow_to_add_external_users\": 1,\n  \"posting_permissions\": 1\n }\n}"
    },
    {
      "name": "**HTTP Status Code:** `400`<br>\nBad Request<br>\n**Error Code:** `200`<br>\nUnauthorized request. You do not have permission to access this user's channel information.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/chat/channels/:channelId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "chat",
            "channels",
            ":channelId"
          ],
          "variable": [
            {
              "key": "channelId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Channel ID: Unique Identifier of a channel."
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**Status Code:** `404`<br>\nNot found.<br>\n**Error Code:** `4130`<br>\nChannel does not exist: $channelId.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/chat/channels/:channelId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "chat",
            "channels",
            ":channelId"
          ],
          "variable": [
            {
              "key": "channelId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Channel ID: Unique Identifier of a channel."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}