接口描述
请求方式:
GET请求地址:
https://api.account.tencent.com/openapi/v3/contacts/departments/:department_id/direct_users调用该接口查询指定部门的直属用户信息,包括用户 ID、名称、加入时间、头像及状态等信息。
注意:
默认只返回处于正常状态的用户数据;
分页大小默认值为10,上限为2000;
ignore_status 参数默认不忽略状态(即仅返回正常状态用户);支持分页查询,通过
page_token 获取后续页数据。输入参数
请求头
名称 | 类型 | 必填 | 描述 |
Authorization | string | 是 | 值格式: Bearer {{access_token}} 支持鉴权类型: |
Content-Type | string | 是 | 固定值: application/json; charset=utf-8 |
路径参数
名称 | 类型 | 必填 | 描述 |
department_id | string | 是 | 部门 id 示例值:"13580**************31" |
查询参数
名称 | 类型 | 必填 | 描述 |
page_size | int | 是 | 分页大小,取值范围 [10, 2000]。 示例值:10 |
page_token | string | 否 | 分页 token,默认查询第一页;后续页需传入上一页返回的 page_token |
ignore_status | bool | 否 | 是否忽略状态,默认 False(不忽略,仅返回正常状态用户)True:不论用户状态均返回 False:仅返回正常状态用户 示例值:False |
输出参数
参数名称 | 类型 | 描述 |
users | array<object> | 用户列表(精简结构) |
└ union_id | string | 用户 union_id |
└ name | string | 姓名 |
└ status | string | 用户状态 |
└ is_main_department | bool | 是否主部门 |
trace_id | string | 唯一请求 ID |
示例
输入示例
GET https://api.account.tencent.com/openapi/v3/contacts/departments/13580************31/direct_users?page_size=10Authorization: Bearer {access_token}
输出示例
正常输出
{"code": 0,"msg": "ok","trace_id": "cd8a67683e50a4e81d8db195c6bd0bff","data": {"users": [{"name": "张三","status": "Enabled","union_id": "13833************36","is_main_department": true},{"name": "李四","status": "Enabled","union_id": "14035************72","is_main_department": true},{"name": "王五","status": "Enabled","union_id": "14560************15","is_main_department": true}]}}
page_size 缺失或越界
{"code": 10030,"msg": "[pageSize]页面大小不正确","data": null}
错误码
说明:
错误码 | 描述 |
200001 | 用户不存在 |
201001 | 部门【%s】不存在 |
202011 | 部门或用户【%s】不存在 |
10030 | 参数不正确(page_size 缺失或越界,HTTP 400) |