Chilkat Online Tools

delphiDll / Zoom API / Update a channel

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
req: HCkHttpRequest;
resp: HCkHttpResponse;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;

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

http := CkHttp_Create();

req := CkHttpRequest_Create();
CkHttpRequest_putHttpVerb(req,'PATCH');
CkHttpRequest_putPath(req,'/v2/chat/channels/:channelId');
CkHttpRequest_putContentType(req,'multipart/form-data');
CkHttpRequest_AddParam(req,'est ex','');

CkHttpRequest_AddHeader(req,'Authorization','Bearer <access_token>');

resp := CkHttp_SynchronousRequest(http,'api.zoom.us',443,True,req);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

sbResponseBody := CkStringBuilder_Create();
CkHttpResponse_GetBodySb(resp,sbResponseBody);

jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);

Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));

respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttpResponse__header(resp));
    Memo1.Lines.Add('Failed.');
    CkHttpResponse_Dispose(resp);
    Exit;
  end;
CkHttpResponse_Dispose(resp);

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

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'name=est ex'
https://api.zoom.us/v2/chat/channels/:channelId

Postman Collection Item JSON

{
  "name": "Update a channel",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "name",
          "value": "est ex",
          "description": "(Required) A new name for the channel.",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/chat/channels/:channelId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "chat",
        "channels",
        ":channelId"
      ],
      "variable": [
        {
          "key": "channelId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) Channel Id."
        }
      ]
    },
    "description": "Zoom chat channels allow users to communicate via chat in private or public channels. Use this API to update the name of a specific channel that you created. \n\n**Scope:** `chat_channel:write`\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:#01579b; padding:8px\"> <b>Note: </b> This API only supports <b>user-managed</b> <a href=\"https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-oauth-app\">OAuth app</a>.</p><br>\n\n"
  },
  "response": [
    {
      "name": "**Status Code:** `204`\nChannel updated.",
      "originalRequest": {
        "method": "PATCH",
        "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."
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "**Status Code:** `400`<br>\nBad request<br>\n**Error Code:** `200`<br>\nUnauthorized request. You do not have permission to update a channel for this user.<br>\n**Error Code:** `5301`<br>\nRequest to update a channel failed.",
      "originalRequest": {
        "method": "PATCH",
        "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."
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}