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

# グループチャットの更新

> グループチャットの名前、メンバー、オーナー、プロフィール写真などを更新してグループ構成と設定を管理します

本インターフェースを呼び出し、グループの chatid を通じて指定したグループチャットのベーシック情報およびメンバーを更新します。グループ名、グループ作成者、メンバーリスト、グループのプロフィール写真などのグループ関連情報を変更でき、グループ管理者がグループ設定を変更したり、グループメンバーを調整したりするシナリオに適しています。

## リクエスト

### ベーシック情報

| フィールド         | 値                                                                                            |
| ------------- | -------------------------------------------------------------------------------------------- |
| HTTP URL      | [https://api.dingtalk.io/v1.0/im/group/update](https://api.dingtalk.io/v1.0/im/group/update) |
| HTTP Method   | POST                                                                                         |
| サポートされるアプリタイプ | appType-社内アプリ                                                                                |
| 必要な権限         | permission-qyapi\_chat\_manage-DingTalk グループのベーシック情報管理権限                                     |

### リクエストヘッダー

| 名前                          | タイプ    | 必須 | 説明                                                                                                                                      |
| --------------------------- | ------ | -- | --------------------------------------------------------------------------------------------------------------------------------------- |
| x-acs-dingtalk-access-token | String | はい | 本インターフェースを呼び出すためのアクセス認証情報。[社内アプリの access\_token を取得する](/ja/open/development/obtain-the-access-token-of-an-internal-app)インターフェースで取得できます。 |

### リクエストボディ

| 名前                  | タイプ             | 必須  | 説明                                                                                                                                                                          |
| ------------------- | --------------- | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| chatid              | String          | はい  | グループチャット ID。[グループチャットを作成する](/ja/open/development/create-common-group-new-version-v2)インターフェースの呼び出しで取得した chatid パラメータの値を使用できます。  フロントエンドの JSAPI を呼び出して取得した chatid はサポートされません。 |
| name                | String          | いいえ | グループ名。長さは 1～20 文字に制限されます。                                                                                                                                                   |
| owner               | String          | いいえ | グループ作成者の userId。[電話番号からユーザーを照会する](/ja/open/development/query-users-by-phone-number)インターフェースで userId を取得できます。  該当社員はチャットの useridlist のメンバーの 1 人である必要があります。                   |
| ownerType           | String          | いいえ | グループ作成者のタイプ。   - **emp**：企業の社員 - **ext**：外部連絡先                                                                                                                              |
| add\_useridlist     | Array of String | いいえ | userId リスト。                                                                                                                                                                 |
| del\_useridlist     | Array of String | いいえ | userId リスト。                                                                                                                                                                 |
| add\_extidlist      | Array of String | いいえ | unionid リスト。[ユーザー詳細を照会する](/ja/open/development/query-users-by-phone-number)インターフェースで取得できます。                                                                                 |
| del\_extidlist      | Array of String | いいえ | unionId リスト。[ユーザー詳細を照会する](/ja/open/development/query-users-by-phone-number)インターフェースで取得できます。                                                                                 |
| icon                | String          | いいえ | グループのプロフィール写真の mediaId。[メディアファイルをアップロードする](/ja/open/development/upload-media-files)インターフェースで media\_id パラメータの値を取得できます。                                                      |
| managementOptions   | Object          | いいえ | グループの属性。                                                                                                                                                                    |
| mentionAllAuthority | Integer         | いいえ | @all の使用範囲。   - **0**（デフォルト）：全員が使用可能 - **1**：グループ作成者のみが @all 可能                                                                                                             |
| showHistoryType     | Integer         | いいえ | 新メンバーが過去 100 件のチャット履歴を閲覧できるかどうか。   - **1**：閲覧可能 - **0**：閲覧不可   値を渡さない場合は閲覧不可を意味します。                                                                                         |
| validationType      | Integer         | いいえ | グループ参加に認証が必要かどうか。   - **0**（デフォルト）：認証なし - **1**：参加認証あり                                                                                                                      |
| searchable          | Integer         | いいえ | グループが検索可能かどうか。   - 0（デフォルト）：検索不可 - 1：検索可能                                                                                                                                   |
| chatBannedType      | Integer         | いいえ | グループの発言禁止をオンにするかどうか。   - **0**（デフォルト）：発言禁止なし - **1**：全員ミュート                                                                                                                 |
| managementType      | Integer         | いいえ | グループ管理のタイプ。   - **0**（デフォルト）：全員が管理可能 - **1**：グループ作成者のみが管理可能                                                                                                                 |

### リクエスト例

HTTP

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
POST /v1.0/im/group/update HTTP/1.1
Host:api.dingtalk.io
x-acs-dingtalk-access-token:6d1bxxxx
Content-Type:application/json

{
  "chatid" : "chatxxxx",
  "name" : "全員グループ。",
  "owner" : "04201724372xxxx",
  "ownerType" : "emp",
  "add_useridlist" : [ "userid1" ],
  "del_useridlist" : [ "userid1" ],
  "add_extidlist" : [ "unionId" ],
  "del_extidlist" : [ "unionId" ],
  "icon" : "@mediaId",
  "managementOptions" : {
    "mentionAllAuthority" : 0,
    "showHistoryType" : 0,
    "validationType" : 0,
    "searchable" : 0,
    "chatBannedType" : 0,
    "managementType" : 0
  }
}
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>Token を使用してアカウント Client を初期化します</p>
     * @return Client
     * 
     * @throws Exception
     */
    public static com.aliyun.dingtalkim_1_0.Client createClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
        config.protocol = "https";
        config.regionId = "central";
        return new com.aliyun.dingtalkim_1_0.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        
        com.aliyun.dingtalkim_1_0.Client client = Sample.createClient();
        com.aliyun.dingtalkim_1_0.models.UpdateGroupHeaders updateGroupHeaders = new com.aliyun.dingtalkim_1_0.models.UpdateGroupHeaders();
        updateGroupHeaders.xAcsDingtalkAccessToken = "<your access token>";
        com.aliyun.dingtalkim_1_0.models.UpdateGroupRequest.UpdateGroupRequestManagementOptions managementOptions = new com.aliyun.dingtalkim_1_0.models.UpdateGroupRequest.UpdateGroupRequestManagementOptions()
                .setMentionAllAuthority(0)
                .setShowHistoryType(0)
                .setValidationType(0)
                .setSearchable(0)
                .setChatBannedType(0)
                .setManagementType(0);
        com.aliyun.dingtalkim_1_0.models.UpdateGroupRequest updateGroupRequest = new com.aliyun.dingtalkim_1_0.models.UpdateGroupRequest()
                .setChatid("chatxxxx")
                .setName("全員グループ。")
                .setOwner("04201724372xxxx")
                .setOwnerType("emp")
                .setAddUseridlist(java.util.Arrays.asList(
                    "userid1"
                ))
                .setDelUseridlist(java.util.Arrays.asList(
                    "userid1"
                ))
                .setAddExtidlist(java.util.Arrays.asList(
                    "unionId"
                ))
                .setDelExtidlist(java.util.Arrays.asList(
                    "unionId"
                ))
                .setIcon("@mediaId")
                .setManagementOptions(managementOptions);
        try {
            client.updateGroupWithOptions(updateGroupRequest, updateGroupHeaders, new com.aliyun.teautil.models.RuntimeOptions());
        } catch (TeaException err) {
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
            }

        } catch (Exception _err) {
            TeaException err = new TeaException(_err.getMessage(), _err);
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
            }

        }        
    }
}
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys
import json

from typing import List

from alibabacloud_dingtalk.im_1_0.client import Client as dingtalkim_1_0Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_dingtalk.im_1_0 import models as dingtalkim__1__0_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient

class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client() -> dingtalkim_1_0Client:
        """
        Token を使用してアカウント Client を初期化します
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config()
        config.protocol = 'https'
        config.region_id = 'central'
        return dingtalkim_1_0Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        update_group_headers = dingtalkim__1__0_models.UpdateGroupHeaders()
        update_group_headers.x_acs_dingtalk_access_token = '<your access token>'
        management_options = dingtalkim__1__0_models.UpdateGroupRequestManagementOptions(
            mention_all_authority=0,
            show_history_type=0,
            validation_type=0,
            searchable=0,
            chat_banned_type=0,
            management_type=0
        )
        update_group_request = dingtalkim__1__0_models.UpdateGroupRequest(
            chatid='chatxxxx',
            name='全員グループ。',
            owner='04201724372xxxx',
            owner_type='emp',
            add_useridlist=[
                'userid1'
            ],
            del_useridlist=[
                'userid1'
            ],
            add_extidlist=[
                'unionId'
            ],
            del_extidlist=[
                'unionId'
            ],
            icon='@mediaId',
            management_options=management_options
        )
        try:
            client.update_group_with_options(update_group_request, update_group_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err には code と message 属性が含まれており、開発者の問題特定に役立ちます
                pass

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        client = Sample.create_client()
        update_group_headers = dingtalkim__1__0_models.UpdateGroupHeaders()
        update_group_headers.x_acs_dingtalk_access_token = '<your access token>'
        management_options = dingtalkim__1__0_models.UpdateGroupRequestManagementOptions(
            mention_all_authority=0,
            show_history_type=0,
            validation_type=0,
            searchable=0,
            chat_banned_type=0,
            management_type=0
        )
        update_group_request = dingtalkim__1__0_models.UpdateGroupRequest(
            chatid='chatxxxx',
            name='全員グループ。',
            owner='04201724372xxxx',
            owner_type='emp',
            add_useridlist=[
                'userid1'
            ],
            del_useridlist=[
                'userid1'
            ],
            add_extidlist=[
                'unionId'
            ],
            del_extidlist=[
                'unionId'
            ],
            icon='@mediaId',
            management_options=management_options
        )
        try:
            await client.update_group_with_options_async(update_group_request, update_group_headers, util_models.RuntimeOptions())
        except Exception as err:
            if not UtilClient.empty(err.code) and not UtilClient.empty(err.message):
                # err には code と message 属性が含まれており、開発者の問題特定に役立ちます
                pass

if __name__ == '__main__':
    Sample.main(sys.argv[1:])
```

PHP

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
<?php

// This file is auto-generated, don't edit it. Thanks.
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Dingtalk\Vim_1_0\Dingtalk;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaError;
use AlibabaCloud\Tea\Utils\Utils;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dingtalk\Vim_1_0\Models\UpdateGroupHeaders;
use AlibabaCloud\SDK\Dingtalk\Vim_1_0\Models\UpdateGroupRequest\managementOptions;
use AlibabaCloud\SDK\Dingtalk\Vim_1_0\Models\UpdateGroupRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;

class Sample {

    /**
     * Token を使用してアカウント Client を初期化します
     * @return Dingtalk Client
     */
    public static function createClient(){
        $config = new Config([]);
        $config->protocol = "https";
        $config->regionId = "central";
        return new Dingtalk($config);
    }

    /**
     * @param string[] $args
     * @return void
     */
    public static function main($args){
        $client = self::createClient();
        $updateGroupHeaders = new UpdateGroupHeaders([]);
        $updateGroupHeaders->xAcsDingtalkAccessToken = "<your access token>";
        $managementOptions = new managementOptions([
            "mentionAllAuthority" => 0,
            "showHistoryType" => 0,
            "validationType" => 0,
            "searchable" => 0,
            "chatBannedType" => 0,
            "managementType" => 0
        ]);
        $updateGroupRequest = new UpdateGroupRequest([
            "chatid" => "chatxxxx",
            "name" => "全員グループ。",
            "owner" => "04201724372xxxx",
            "ownerType" => "emp",
            "addUseridlist" => [
                "userid1"
            ],
            "delUseridlist" => [
                "userid1"
            ],
            "addExtidlist" => [
                "unionId"
            ],
            "delExtidlist" => [
                "unionId"
            ],
            "icon" => "@mediaId",
            "managementOptions" => $managementOptions
        ]);
        try {
            $client->updateGroupWithOptions($updateGroupRequest, $updateGroupHeaders, new RuntimeOptions([]));
        }
        catch (Exception $err) {
            if (!($err instanceof TeaError)) {
                $err = new TeaError([], $err->getMessage(), $err->getCode(), $err);
            }
            if (!Utils::empty_($err->code) && !Utils::empty_($err->message)) {
                // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
            }
        }
    }
}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main(array_slice($argv, 1));
```

Go

```go theme={"theme":{"light":"github-light","dark":"github-dark"}}
package main

import (
  "encoding/json"
  "strings"
  "fmt"
  "os"
  util  "github.com/alibabacloud-go/tea-utils/v2/service"
  dingtalkim_1_0  "github.com/alibabacloud-go/dingtalk/im_1_0"
  openapi  "github.com/alibabacloud-go/darabonba-openapi/v2/client"
  "github.com/alibabacloud-go/tea/tea"
)

// Description:
// 
// Token を使用してアカウント Client を初期化します
// 
// @return Client
// 
// @throws Exception
func CreateClient () (_result *dingtalkim_1_0.Client, _err error) {
  config := &openapi.Config{}
  config.Protocol = tea.String("https")
  config.RegionId = tea.String("central")
  _result = &dingtalkim_1_0.Client{}
  _result, _err = dingtalkim_1_0.NewClient(config)
  return _result, _err
}

func _main (args []*string) (_err error) {
  client, _err := CreateClient()
  if _err != nil {
    return _err
  }

  updateGroupHeaders := &dingtalkim_1_0.UpdateGroupHeaders{}
  updateGroupHeaders.XAcsDingtalkAccessToken = tea.String("<your access token>")
  managementOptions := &dingtalkim_1_0.UpdateGroupRequestManagementOptions{
    MentionAllAuthority: tea.Int32(0),
    ShowHistoryType: tea.Int32(0),
    ValidationType: tea.Int32(0),
    Searchable: tea.Int32(0),
    ChatBannedType: tea.Int32(0),
    ManagementType: tea.Int32(0),
  }
  updateGroupRequest := &dingtalkim_1_0.UpdateGroupRequest{
    Chatid: tea.String("chatxxxx"),
    Name: tea.String("全員グループ。"),
    Owner: tea.String("04201724372xxxx"),
    OwnerType: tea.String("emp"),
    AddUseridlist: []*string{tea.String("userid1")},
    DelUseridlist: []*string{tea.String("userid1")},
    AddExtidlist: []*string{tea.String("unionId")},
    DelExtidlist: []*string{tea.String("unionId")},
    Icon: tea.String("@mediaId"),
    ManagementOptions: managementOptions,
  }
  tryErr := func()(_e error) {
    defer func() {
      if r := tea.Recover(recover()); r != nil {
        _e = r
      }
    }()
    _, _err = client.UpdateGroupWithOptions(updateGroupRequest, updateGroupHeaders, &util.RuntimeOptions{})
    if _err != nil {
      return _err
    }

    return nil
  }()

  if tryErr != nil {
    var err = &tea.SDKError{}
    if _t, ok := tryErr.(*tea.SDKError); ok {
      err = _t
    } else {
      err.Message = tea.String(tryErr.Error())
    }
    if !tea.BoolValue(util.Empty(err.Code)) && !tea.BoolValue(util.Empty(err.Message)) {
      // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
    }

  }
  return _err
}

func main() {
  err := _main(tea.StringSlice(os.Args[1:]))
  if err != nil {
    panic(err)
  }
}
```

Node.js

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
'use strict';
// This file is auto-generated, don't edit it
const Util = require('@alicloud/tea-util');
const dingtalkim_1_0 = require('@alicloud/dingtalk/im_1_0');
const OpenApi = require('@alicloud/openapi-client');
const Tea = require('@alicloud/tea-typescript');

class Client {

  /**
   * Token を使用してアカウント Client を初期化します
   * @return Client
   * @throws Exception
   */
  static createClient() {
    let config = new OpenApi.Config({ });
    config.protocol = 'https';
    config.regionId = 'central';
    return new dingtalkim_1_0.default(config);
  }

  static async main(args) {
    let client = Client.createClient();
    let updateGroupHeaders = new dingtalkim_1_0.UpdateGroupHeaders({ });
    updateGroupHeaders.xAcsDingtalkAccessToken = '<your access token>';
    let managementOptions = new dingtalkim_1_0.UpdateGroupRequestManagementOptions({
      mentionAllAuthority: 0,
      showHistoryType: 0,
      validationType: 0,
      searchable: 0,
      chatBannedType: 0,
      managementType: 0,
    });
    let updateGroupRequest = new dingtalkim_1_0.UpdateGroupRequest({
      chatid: 'chatxxxx',
      name: '全員グループ。',
      owner: '04201724372xxxx',
      ownerType: 'emp',
      addUseridlist: [
        'userid1'
      ],
      delUseridlist: [
        'userid1'
      ],
      addExtidlist: [
        'unionId'
      ],
      delExtidlist: [
        'unionId'
      ],
      icon: '@mediaId',
      managementOptions: managementOptions,
    });
    try {
      await client.updateGroupWithOptions(updateGroupRequest, updateGroupHeaders, new Util.RuntimeOptions({ }));
    } catch (err) {
      if (!Util.default.empty(err.code) && !Util.default.empty(err.message)) {
        // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
      }

    }    
  }

}

exports.Client = Client;
Client.main(process.argv.slice(2));
```

C#

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

using Tea;
using Tea.Utils;

namespace AlibabaCloud.SDK.Sample
{
    public class Sample 
    {

        /// <term><b>Description:</b></term>
        /// <description>
        /// <para>Token を使用してアカウント Client を初期化します</para>
        /// </description>
        /// 
        /// <returns>
        /// Client
        /// </returns>
        /// 
        /// <term><b>Exception:</b></term>
        /// Exception
        public static AlibabaCloud.SDK.Dingtalkim_1_0.Client CreateClient()
        {
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
            config.Protocol = "https";
            config.RegionId = "central";
            return new AlibabaCloud.SDK.Dingtalkim_1_0.Client(config);
        }

        public static void Main(string[] args)
        {
            AlibabaCloud.SDK.Dingtalkim_1_0.Client client = CreateClient();
            AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupHeaders updateGroupHeaders = new AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupHeaders();
            updateGroupHeaders.XAcsDingtalkAccessToken = "<your access token>";
            AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupRequest.UpdateGroupRequestManagementOptions managementOptions = new AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupRequest.UpdateGroupRequestManagementOptions
            {
                MentionAllAuthority = 0,
                ShowHistoryType = 0,
                ValidationType = 0,
                Searchable = 0,
                ChatBannedType = 0,
                ManagementType = 0,
            };
            AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupRequest updateGroupRequest = new AlibabaCloud.SDK.Dingtalkim_1_0.Models.UpdateGroupRequest
            {
                Chatid = "chatxxxx",
                Name = "全員グループ。",
                Owner = "04201724372xxxx",
                OwnerType = "emp",
                AddUseridlist = new List<string>
                {
                    "userid1"
                },
                DelUseridlist = new List<string>
                {
                    "userid1"
                },
                AddExtidlist = new List<string>
                {
                    "unionId"
                },
                DelExtidlist = new List<string>
                {
                    "unionId"
                },
                Icon = "@mediaId",
                ManagementOptions = managementOptions,
            };
            try
            {
                client.UpdateGroupWithOptions(updateGroupRequest, updateGroupHeaders, new AlibabaCloud.TeaUtil.Models.RuntimeOptions());
            }
            catch (TeaException err)
            {
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
                }
            }
            catch (Exception _err)
            {
                TeaException err = new TeaException(new Dictionary<string, object>
                {
                    { "message", _err.Message }
                });
                if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
                {
                    // err には code と message 属性が含まれており、開発者の問題特定に役立ちます
                }
            }
        }

    }
}
```

## レスポンス

### レスポンスボディ

| 名前      | タイプ     | 説明        |
| ------- | ------- | --------- |
| success | Boolean | 成功したかどうか。 |

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

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
Content-Type:application/json

{
  "success" : true
}
```

### エラーコード

本インターフェースの呼び出しでエラーが発生した場合、エラーメッセージをもとに[グローバルエラーコード](/ja/open/development/server-api-error-codes-1)ドキュメントから解決策を確認できます。

| HttpCode | エラーコード                 | エラーメッセージ                         | 説明                                |
| -------- | ---------------------- | -------------------------------- | --------------------------------- |
| 400      | parameter.invalid      | 入力パラメータエラー                       | インターフェースの要件に従って、必要なパラメータを渡してください。 |
| 400      | permession.checkFailed | 権限チェック失敗                         | 権限チェック失敗                          |
| 400      | permession.checkFailed | グループ作成者がアプリの可視範囲内にいません           | グループ作成者がアプリの可視範囲内にいません            |
| 500      | system.error           | 再試行してください。常に失敗する場合はチケットを送信してください | 再試行してください。常に失敗する場合はチケットを送信してください  |
