> ## 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/updategroupnick](https://api.dingtalk.io/topapi/chat/updategroupnick) |
| HTTP Method | POST                                                                                                       |
| 対応アプリタイプ    | appType-社内アプリ                                                                                              |
| 必要な権限       | permission-qyapi\_chat\_manage-DingTalk グループのベーシック情報管理権限                                                   |

### クエリパラメータ

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

### リクエストボディ

| 名前          | タイプ    | 必須 | 例              | 説明                                                                                                                 |
| ----------- | ------ | -- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
| userid      | String | はい | user123        | グループ名を変更するグループメンバーの userId。[グループ情報の取得](/ja/open/development/obtain-a-group-session) API でグループメンバーの userId を取得できます。 |
| chatid      | String | はい | chate3929fxxxx | グループチャット ID。グループ作成 API から chatid パラメータの値を取得できます。                                                                   |
| group\_nick | String | はい | DingTalk 太郎    | 当該メンバーのグループ内での名前。                                                                                                  |

### リクエスト例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/chat/updategroupnick" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=61a72xxxx8d62' \
-d 'chatid=0' \
-d 'group_nick=nick' \
-d 'userid=0'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/updategroupnick");
OapiChatUpdategroupnickRequest req = new OapiChatUpdategroupnickRequest();
req.setUserid("user123");
req.setChatid("chate39f540d572b71cf97a556d95929fxxxx");
req.setGroupNick("DingTalk 太郎");
OapiChatUpdategroupnickResponse 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.OapiChatUpdategroupnickRequest("https://api.dingtalk.io/topapi/chat/updategroupnick")

req.userid="0"
req.chatid="0"
req.group_nick="nick"
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 OapiChatUpdategroupnickRequest;
$req->setUserid("0");
$req->setChatid("0");
$req->setGroupNick("nick");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/chat/updategroupnick");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/updategroupnick");
OapiChatUpdategroupnickRequest req = new OapiChatUpdategroupnickRequest();
req.Userid = "0";
req.Chatid = "0";
req.GroupNick = "nick";
OapiChatUpdategroupnickResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

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

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

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

### エラーコード

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

| エラーコード（errorcode） | エラーコードの説明（errmsg）    | 解決方法                              |
| ----------------- | -------------------- | --------------------------------- |
| 40003             | 無効な userid           | userid が正しく入力されているか確認してください       |
| 34001             | 無効な chatid           | chatid が正しいか確認してください              |
| 41049             | 禁止コンテンツを含んでいます       | 入力した名前を修正してください                   |
| 60124             | ユーザーが該当グループに所属していません | グループ内のユーザーを更新してください               |
| 400002            | パラメータエラー             | 上記の入力パラメータの要件に従って入力されているか確認してください |
| 400001            | システムエラー              | 後で再試行してください                       |
