> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Menonaktifkan Obrolan Pribadi untuk anggota grup

> Panggil API ini untuk mengatur apakah anggota grup dapat saling menambahkan sebagai teman dan mengobrol secara pribadi, berguna untuk grup internal yang perlu membatasi komunikasi dan melindungi informasi.

Panggil API ini untuk mengatur apakah anggota grup dapat saling menambahkan sebagai kontak dan memulai obrolan pribadi. API ini berlaku untuk skenario ketika Grup Internal perlu membatasi komunikasi antaranggota atau melindungi keamanan informasi.

## Permintaan

| **Informasi dasar**         |                                                                                                                                  |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| URL HTTP                    | [https://api.dingtalk.io/topapi/chat/member/friendswitch/update](https://api.dingtalk.io/topapi/chat/member/friendswitch/update) |
| Metode HTTP                 | POST                                                                                                                             |
| Tipe aplikasi yang didukung | appType-Aplikasi internal                                                                                                        |
| Izin yang diperlukan        | permission-qyapi\_chat\_manage-Izin pengelolaan informasi dasar grup DingTalk                                                    |

### Parameter kueri

| Nama          | Tipe   | Wajib | Contoh   | Deskripsi                                                                                                                                                            |
| ------------- | ------ | ----- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Ya    | 6d1bxxxx | Kredensial aplikasi untuk memanggil API ini. Dapatkan melalui API untuk memperoleh [access\_token dari Aplikasi internal](/id/open/development/obtain-orgapp-token). |

### Isi permintaan

| Nama         | Tipe    | Wajib | Contoh          | Deskripsi                                                                                                                                                                                                                            |
| ------------ | ------- | ----- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| chatid       | String  | Ya    | chatdafe234xxxx | Chat ID dari organisasi. Dapatkan melalui salah satu cara berikut:   - Panggil Server API untuk membuat grup guna memperoleh nilai parameter chatid. - Panggil API chooseChat di Sisi klien untuk memperoleh nilai parameter chatId. |
| is\_prohibit | Boolean | Ya    | true            | Apakah akan mengaktifkan tombol pembatasan.   - **true**: Aktifkan tombol pembatasan. - **false**: Nonaktifkan tombol pembatasan.                                                                                                    |

### Contoh permintaan

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/chat/member/friendswitch/update" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=774fdexxxx4bdd68c' \
-d 'chatid=chatdafe234sdf3sdf' \
-d 'is_prohibit=true'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
OapiChatMemberFriendswitchUpdateRequest req = new OapiChatMemberFriendswitchUpdateRequest();
req.setChatid("chatdafe234xxxx");
req.setIsProhibit(true);
OapiChatMemberFriendswitchUpdateResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiChatMemberFriendswitchUpdateRequest("https://api.dingtalk.io/topapi/chat/member/friendswitch/update")

req.chatid="chatdafe234sdf3sdf"
req.is_prohibit=true
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
```

PHP

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiChatMemberFriendswitchUpdateRequest;
$req->setChatid("chatdafe234sdf3sdf");
$req->setIsProhibit("true");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/member/friendswitch/update");
OapiChatMemberFriendswitchUpdateRequest req = new OapiChatMemberFriendswitchUpdateRequest();
req.Chatid = "chatdafe234sdf3sdf";
req.IsProhibit = true;
OapiChatMemberFriendswitchUpdateResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Respons

### Isi respons

| Nama        | Tipe    | Contoh        | Deskripsi                                                                |
| ----------- | ------- | ------------- | ------------------------------------------------------------------------ |
| success     | Boolean | true          | Apakah konfigurasi berhasil.   - **true**: Berhasil. - **false**: Gagal. |
| errcode     | Number  | 0             | Kode yang dikembalikan.                                                  |
| errmsg      | String  | ok            | Deskripsi kode yang dikembalikan.                                        |
| request\_id | String  | 10c0wc48i6qzz | ID permintaan.                                                           |

### Contoh respons

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "success":true,
  "errcode":0,
  "errmsg":"ok",
  "request_id":"10c0wc48i6qzz"
}
```

### Kode error

Jika error dikembalikan saat Anda memanggil API ini, lihat dokumentasi [Kode error global](/id/open/development/server-api-error-codes-1) untuk solusinya.

| Kode error (errorcode) | Pesan error (errmsg) | Solusi                                                  |
| ---------------------- | -------------------- | ------------------------------------------------------- |
| 34001                  | Invalid chatid       | Periksa apakah chatid memenuhi persyaratan.             |
| 40036                  | Empty parameter      | Konfirmasi bahwa semua parameter wajib telah diberikan. |
| 400001                 | system error         | Coba lagi nanti.                                        |
