Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/chat/get |
| HTTP Method | GET |
| Supported app types | appType-Internal app |
| Required permissions | permission-qyapi_chat_read-Read permission for basic information of DingTalk groups |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | 6d1bxxxx | The App credential used to call this API. Obtain it through the API for getting the access_token of an internal app. |
| chatid | String | Yes | chate39f540dxxxx | The ID of the group chat. - Only supports the chatid returned by the Server-side Create group chat API. - Does not support the chatid obtained by calling the frontend JSAPI. |
Request example
curl -X GET "https://oapi.dingtalk.io/chat/get" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=0d7e495xxxxa3f694fd6e' \
-d 'chatid=chatid'
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/chat/get");
OapiChatGetRequest req = new OapiChatGetRequest();
req.setChatid("chate39f540dxxxx");
req.setHttpMethod("GET");
OapiChatGetResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiChatGetRequest("https://oapi.dingtalk.io/chat/get")
req.chatid="chatid"
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_GET , DingTalkConstant::$FORMAT_JSON);
$req = new OapiChatGetRequest;
$req->setChatid("chatid");
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.io/chat/get");
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/chat/get");
OapiChatGetRequest req = new OapiChatGetRequest();
req.Chatid = "chatid";
req.SetHttpMethod("GET");
OapiChatGetResponse 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. |
| chat_info | ChatInfo | The group chat information. | |
| name | String | All-staff Chat | The group name. |
| owner | String | manager4220 | The userId of the group owner. |
| useridlist | String[] | [“user123”,“manager4220”] | The list of userIds of group members. |
| conversationTag | Number | 2 | The conversation type: - 2: Organization group. |
| chatBannedType | Number | 0 | Whether Mute members is enabled for the group: - 0 (default): Not muted. - 1: Mute All. |
| searchable | Number | 0 | Whether the group can be searched: - 0 (default): Not searchable. - 1: Searchable. |
| validationType | Number | 0 | Whether verification is required to join the group: - 0 (default): No verification. - 1: Verification required. |
| mentionAllAuthority | Number | 0 | The scope of @all: - 0 (default): Available to everyone. - 1: Only the group owner can use @all. |
| managementType | Number | 0 | The group management type: - 0 (default): Everyone can manage. - 1: Only the group owner can manage. |
| showHistoryType | Number | 0 | Whether new members can view the last 100 historical chats: - 1: Can view. - 0: Cannot view. If no value is passed, new members cannot view. |
| icon | String | @lADPDfJ6Q7LLejDNAljNAlg | The mediaID of the group Profile Photo. |
| status | Number | 1 | The status. - 1: Normal. - 2: Dismissed. |
Response body example
{
"errcode":0,
"errmsg":"ok",
"chat_info":{
"owner":"manager4220",
"mentionAllAuthority":0,
"showHistoryType":0,
"chatid":"chate39f540dxxxx",
"conversationTag":2,
"validationType":0,
"useridlist":[
"user123",
"manager4220"
],
"icon":"@lADPDfJ6Q7LLejDNAljNAlg",
"name":"All-staff Chat",
"searchable":0,
"chatBannedType":0,
"managementType":0
}
}
Error codes
If an error occurs when calling this API, find the solution in the Global error codes document based on the error message.| Error code (errorcode) | Error message (errmsg) | Solution |
|---|---|---|
| 43007 | No permission to call this API. | Confirm whether the access_token is generated by the current App. |
| 49000 | The chatid parameter is required. | Provide the chatid. |
| 40001 | Invalid token. | Confirm whether the access_token is correct. |
| 70001 | The organization does not exist. | Confirm whether the parameters are correct. |
| 40016 | Invalid chatid. | Confirm that the access_token and chatid belong to the same Organization. |
| -1 | System busy. | Try again later. |