> ## 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.

# メンバー間の個別チャットを禁止する設定

> グループメンバー間の連絡先追加と個別チャットを禁止し、メンバー間のやり取り範囲を管理して企業情報セキュリティを保護します

本 API を呼び出して、グループメンバー同士が連絡先追加や個別チャットを行えるかどうかを設定します。社内グループでメンバー間のやり取り範囲を管理し、情報の安全を保護したい場面に適しています。

## リクエスト

| **ベーシック情報** |                                                                                                                                  |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
| HTTP URL    | [https://api.dingtalk.io/topapi/chat/member/friendswitch/update](https://api.dingtalk.io/topapi/chat/member/friendswitch/update) |
| HTTP Method | POST                                                                                                                             |
| 対応アプリタイプ    | appType-社内アプリ                                                                                                                    |
| 必要な権限       | permission-qyapi\_chat\_manage-DingTalk グループのベーシック情報管理権限                                                                         |

### クエリパラメータ

| 名前            | タイプ    | 必須 | 例        | 説明                                                                                                       |
| ------------- | ------ | -- | -------- | -------------------------------------------------------------------------------------------------------- |
| access\_token | String | はい | 6d1bxxxx | 本 API を呼び出すためのアプリ認証情報です。[社内アプリの access\_token 取得](/ja/open/development/obtain-orgapp-token) API から取得します。 |

### リクエストボディ

| 名前           | タイプ     | 必須 | 例               | 説明                                                                                                                               |
| ------------ | ------- | -- | --------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| chatid       | String  | はい | chatdafe234xxxx | 企業チャット ID。以下の方法で取得できます。   - サーバーサイドのグループ作成 API を呼び出して chatid パラメータの値を取得します。 - クライアントサイドの chooseChat を呼び出して chatId パラメータの値を取得します。 |
| is\_prohibit | Boolean | はい | true            | 禁止スイッチをオンにするかどうか。   - **true**：禁止スイッチをオン - **false**：禁止スイッチを閉じる                                                                  |

### リクエスト例

```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);
```

## レスポンス

### レスポンスボディ

| 名前          | タイプ     | 例             | 説明                                          |
| ----------- | ------- | ------------- | ------------------------------------------- |
| success     | Boolean | true          | 設定が成功したかどうか。   - **true**：成功 - **false**：失敗 |
| errcode     | Number  | 0             | リターンコード。                                    |
| errmsg      | String  | ok            | リターンコードの説明。                                 |
| request\_id | String  | 10c0wc48i6qzz | リクエスト ID。                                   |

### レスポンスボディの例

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

### エラーコード

本 API の呼び出しでエラーが発生した場合、エラーメッセージをもとに [グローバルエラーコード](/ja/open/development/server-api-error-codes-1) ドキュメントで解決方法を検索してください。

| エラーコード（errorcode） | エラーコードの説明（errmsg） | 解決方法                        |
| ----------------- | ----------------- | --------------------------- |
| 34001             | 無効な chatid        | chatid が要件を満たしているか確認してください  |
| 40036             | パラメータが空           | 必須パラメータがすべて入力されているか確認してください |
| 400001            | システムエラー           | 後で再試行してください                 |
