Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/chat/updategroupnick |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi_chat_manage-DingTalk group basic information management permission |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | beE3xxxx | The app credential used to call this API. Obtain it through the API for getting the access_token of an internal app. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | user123 | The userId of the group member whose nickname is to be updated. You can obtain the member’s userId through the Get group chat information API. |
| chatid | String | Yes | chate3929fxxxx | The group chat ID. You can obtain the chatid value through the API for creating a group. |
| group_nick | String | Yes | DingTalk Assistant | The member’s nickname within the group. |
Request example
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'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/updategroupnick");
OapiChatUpdategroupnickRequest req = new OapiChatUpdategroupnickRequest();
req.setUserid("user123");
req.setChatid("chate39f540d572b71cf97a556d95929fxxxx");
req.setGroupNick("DingTalk Assistant");
OapiChatUpdategroupnickResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
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)
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");
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);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Indicates whether the action succeeded. - true: Success - false: Failed |
| request_id | String | id1aatxt9mco | The request ID. |
Response example
{
"errcode": 0,
"errmsg": "ok",
"success": true,
"request_id": "id1aatxt9mco"
}
Error codes
If an error is returned when you call this API, refer to the Global error codes document to find the solution based on the error message.| Error code (errorcode) | Error message (errmsg) | Solution |
|---|---|---|
| 40003 | Invalid userid | Verify that the userid is entered correctly. |
| 34001 | Invalid chatid | Verify that the chatid is correct. |
| 41049 | Contains prohibited content | Modify the nickname you entered. |
| 60124 | The user is not in the corresponding group | Update the users in the group. |
| 400002 | Parameter error | Check that the parameters are entered according to the requirements above. |
| 400001 | System error | Try again later. |