Appearance
批量获取通讯录详细信息
把 getSyncList 的节点列表换成每个节点的详细资料(成员资料 / 部门信息)。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
appid | 是 | string | 实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx |
nodeList | 是 | array<object> | 通讯录节点列表。示例:[{"type":2,"partyId":1688855319807972,"seq":7650540819522… |
nodeList[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
nodeList[].type | int64 | 类型编码 |
nodeList[].partyId | int64 | 部门/组织 id |
nodeList[].seq | int64 | 同步游标(增量翻页位置) |
请求示例
http
POST {BASE_URL}/wx-api/api/contact/fetchUsersProfileBatch
Authorization: Bearer <你的 App Token>
Content-Type: application/json
{
"appid": "we_xxxxxxxxxxxxxxx",
"nodeList": [
{
"type": 2,
"partyId": 1688855319807972,
"seq": 7650540819522256897
},
{
"type": 1,
"vid": 1688855319807969,
"partyId": 1688855319807972,
"seq": 7650540875642044417
}
]
}bash
curl -X POST '{BASE_URL}/wx-api/api/contact/fetchUsersProfileBatch' \
-H 'Authorization: Bearer <你的 App Token>' \
-H 'Content-Type: application/json' \
--data-raw '{
"appid": "we_xxxxxxxxxxxxxxx",
"nodeList": [
{
"type": 2,
"partyId": 1688855319807972,
"seq": 7650540819522256897
},
{
"type": 1,
"vid": 1688855319807969,
"partyId": 1688855319807972,
"seq": 7650540875642044417
}
]
}'python
import requests
url = "{BASE_URL}/wx-api/api/contact/fetchUsersProfileBatch"
headers = {"Authorization": "Bearer <你的 App Token>", "Content-Type": "application/json"}
body = """{
"appid": "we_xxxxxxxxxxxxxxx",
"nodeList": [
{
"type": 2,
"partyId": 1688855319807972,
"seq": 7650540819522256897
},
{
"type": 1,
"vid": 1688855319807969,
"partyId": 1688855319807972,
"seq": 7650540875642044417
}
]
}"""
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}/wx-api/api/contact/fetchUsersProfileBatch";
String body = "{\n" +
" \"appid\": \"we_xxxxxxxxxxxxxxx\",\n" +
" \"nodeList\": [\n" +
" {\n" +
" \"type\": 2,\n" +
" \"partyId\": 1688855319807972,\n" +
" \"seq\": 7650540819522256897\n" +
" },\n" +
" {\n" +
" \"type\": 1,\n" +
" \"vid\": 1688855319807969,\n" +
" \"partyId\": 1688855319807972,\n" +
" \"seq\": 7650540875642044417\n" +
" }\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());php
<?php
$url = '{BASE_URL}/wx-api/api/contact/fetchUsersProfileBatch';
$body = <<<'JSON'
{
"appid": "we_xxxxxxxxxxxxxxx",
"nodeList": [
{
"type": 2,
"partyId": 1688855319807972,
"seq": 7650540819522256897
},
{
"type": 1,
"vid": 1688855319807969,
"partyId": 1688855319807972,
"seq": 7650540875642044417
}
]
}
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;响应示例
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
code | int64 | 统一封套状态码:0=成功,负数=失败 |
detail | string | 附加明细,通常为空 |
message | string | 文案:成功为 ok;失败形如 -码|描述 |
time | string | 服务端处理时间 YYYY-MM-DD HH:MM:SS |