Appearance
获取用户信息详情
按用户 id 列表直接查最全的用户资料(内部成员或外部联系人均可)。比 fetchUsersProfileBatch 更全,多一层 level。
说明与注意
- data 是数组,每个查询 id 一项
{vid, info, level};不是单对象 data.info。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
appid | 是 | string | 实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx |
userIdList | 是 | array<int64> | 用户 id 列表(内部成员或外部联系人)。示例:[1688855874759204,1688857990821417,7881301709020163,78813… |
请求示例
http
POST {BASE_URL}/wx-api/api/contact/getUserProfileDetail
Authorization: Bearer <你的 App Token>
Content-Type: application/json
{
"appid": "we_xxxxxxxxxxxxxxx",
"userIdList": [
1688855874759204,
1688857990821417,
7881301709020163,
7881300286335405
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
bash
curl -X POST '{BASE_URL}/wx-api/api/contact/getUserProfileDetail' \
-H 'Authorization: Bearer <你的 App Token>' \
-H 'Content-Type: application/json' \
--data-raw '{
"appid": "we_xxxxxxxxxxxxxxx",
"userIdList": [
1688855874759204,
1688857990821417,
7881301709020163,
7881300286335405
]
}'1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
python
import requests
url = "{BASE_URL}/wx-api/api/contact/getUserProfileDetail"
headers = {"Authorization": "Bearer <你的 App Token>", "Content-Type": "application/json"}
body = """{
"appid": "we_xxxxxxxxxxxxxxx",
"userIdList": [
1688855874759204,
1688857990821417,
7881301709020163,
7881300286335405
]
}"""
resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "{BASE_URL}/wx-api/api/contact/getUserProfileDetail";
String body = "{\n" +
" \"appid\": \"we_xxxxxxxxxxxxxxx\",\n" +
" \"userIdList\": [\n" +
" 1688855874759204,\n" +
" 1688857990821417,\n" +
" 7881301709020163,\n" +
" 7881300286335405\n" +
" ]\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的 App Token>")
.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());1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
php
<?php
$url = '{BASE_URL}/wx-api/api/contact/getUserProfileDetail';
$body = <<<'JSON'
{
"appid": "we_xxxxxxxxxxxxxxx",
"userIdList": [
1688855874759204,
1688857990821417,
7881301709020163,
7881300286335405
]
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的 App Token>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
响应示例
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
code | int64 | 统一封套状态码:0=成功,负数=失败 |
data | array<object> | 用户资料列表,每项为 {vid, info, level} |
detail | string | 附加明细,通常为空 |
message | string | 文案:成功为 ok;失败形如 -码|描述 |
time | string | 服务端处理时间 YYYY-MM-DD HH:MM:SS |