Appearance
获取群信息
查询群资料和成员概要。
接口地址: POST /getChatRoomInfo
说明与注意
- 群名会变,用
chatRoomId做唯一标识,别用群名。 - 只需要成员列表时用获取群成员列表。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
wId | 是 | string | 登录实例标识 |
chatRoomId | 是 | string | 群 ID |
请求示例
http
POST {BASE_URL}/getChatRoomInfo
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "349be9b5-8734-45ce-811d-4e10ca568c67",
"chatRoomId": "24343869723@chatroom"
}bash
curl -X POST '{BASE_URL}/getChatRoomInfo' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "349be9b5-8734-45ce-811d-4e10ca568c67",
"chatRoomId": "24343869723@chatroom"
}'python
import requests
url = "{BASE_URL}/getChatRoomInfo"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "349be9b5-8734-45ce-811d-4e10ca568c67",
"chatRoomId": "24343869723@chatroom"
}"""
resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "{BASE_URL}/getChatRoomInfo";
String body = "{\n" +
" \"wId\": \"349be9b5-8734-45ce-811d-4e10ca568c67\",\n" +
" \"chatRoomId\": \"24343869723@chatroom\"\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的调用凭证>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());php
<?php
$url = '{BASE_URL}/getChatRoomInfo';
$body = <<<'JSON'
{
"wId": "349be9b5-8734-45ce-811d-4e10ca568c67",
"chatRoomId": "24343869723@chatroom"
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的调用凭证>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;成功响应
json
{
"message": "成功",
"code": "1000",
"data": [
{
"chatRoomId": "24343869723@chatroom",
"userName": null,
"nickName": "",
"chatRoomOwner": "wxid_ylxtflcg0p8b22",
"bigHeadImgUrl": null,
"smallHeadImgUrl": "http://wx.qlogo.cn/mmcrhead/S44kIgicdUQ1LwXCuMlDEnV37pDE2RNYOq5ic7GpZR6icDPT1UvIh7iaKh7rKZMicatXKuvB9J0gIDGVDwKTpeBMyLpoCd3FEhNGic/0",
"v1": "v1_f4ef1dde421ba4039ee0e7a2dcd555fc7a18bcb3b77face81f425e5ec66e8cab814857df2124c60cc144df1ecc83a096@stranger",
"memberCount": 3,
"chatRoomMembers": [
{
"userName": "wxid_wl9qchkanp9u22",
"nickName": "E云通知小助手(微信实例)",
"inviterUserName": "wxid_ylxtflcg0p8b22"
},
{
"userName": "wxid_i6qsbbjenjuj22",
"nickName": "E云Team_Mr Li",
"inviterUserName": "wxid_ylxtflcg0p8b22"
},
{
"userName": "wxid_ylxtflcg0p8b22",
"nickName": "售前客服-小诺 (工作日9:00-18:00)",
"inviterUserName": ""
}
]
}
]
}错误响应
json
{
"message": "失败",
"code": "1001",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
code | string | 1000 成功;其他值都是失败,通常是 1001 |
message | string | 反馈信息 |
data | array | 群信息列表 |
data[].chatRoomId | string | 群 ID |
data[].userName | string/null | 群成员微信 ID,群概要中可能为空 |
data[].nickName | string | 群名称 |
data[].chatRoomOwner | string | 群主 ID |
data[].bigHeadImgUrl | string/null | 大头像 URL |
data[].smallHeadImgUrl | string | 小头像 URL |
data[].v1 | string | 群 v1 |
data[].memberCount | int | 群成员数 |
data[].chatRoomMembers | array | 群成员概要列表 |
data[].chatRoomMembers[].userName | string | 群成员微信 ID |
data[].chatRoomMembers[].nickName | string | 群成员昵称 |
data[].chatRoomMembers[].inviterUserName | string | 邀请人微信 ID,群主或管理员通常可见 |