批量重置企业成员的账号密码。
users:write
|
参数 |
类型 |
是否必填 |
描述 |
|---|---|---|---|
users |
array | 是 | 成员数组。最多传入 100 个成员。 |
users[].email |
string | 条件必填 | 成员的邮箱地址。与 user_id 至少传入一个。邮箱不区分大小写。 |
|
|
string |
条件必填 |
成员的用户 ID。与 你需要调用 “获取成员列表” 接口来获取成员的用户 ID,详情参考获取成员列表。 |
|
|
string |
是 |
新的密码。 长度至少 8 位;不能包含空白字符;大写字母、小写字母、数字、特殊字符四类中至少包含三类。 |
注意
users 数组中的同一个元素中,若你同时传入 email 和 user_id,需确保两者指向同一个成员,否则将无法为该成员重置密码。email 和 user_id 指向同一成员,则第一个元素会被处理,后续重复元素会失败。|
参数 |
类型 |
描述 |
|---|---|---|
success_count |
int | 成功重置密码的成员数量。 |
failed_items |
array | 重置密码失败的成员列表。全部成功时返回 []。 |
failed_items[].index |
int | 重置密码失败的成员在请求中传入的 users 数组中的下标,从 0 开始。 |
failed_items[].email |
string | 若在请求中传入了成员的邮箱,则返回该邮箱,否则省略。 |
failed_items[].user_id |
string | 若在请求中传入了成员的用户 ID,则返回该用户 ID,否则省略。 |
failed_items[].code |
int | 错误码。详情参考错误码。 |
failed_items[].message |
string | 错误消息,用于说明重置密码失败的原因。 |
提示
当 code 为 0 且 failed_items 不为空时,表示接口调用成功,但部分成员重置密码失败。请根据 failed_items 中的 index、email、user_id 和错误码定位失败成员,并修正后重试。
curl -X POST "${HOST}/openapi/v1/users/reset_password" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"users": [
{
"email": "john@example.com",
"password": "NewAa123!"
},
{
"user_id": "123456789012345678",
"password": "NewBb123!"
}
]
}'
{
"code": 0,
"message": "success",
"request_id": "021xxxxxxxxx",
"data": {
"success_count": 1,
"failed_items": [
{
"index": 1,
"email": "bob@example.com",
"user_id": "123456",
"code": 30019,
"message": "password invalid"
}
]
}
}