接口描述
请求方式:
GET请求地址:
https://api.account.tencent.com/openapi/v3/contacts/departments/{department_id}用该接口查询部门信息,包括部门 ID、名称、层级关系、负责人及用户数量等信息。
注意:
默认返回部门基础信息,部分字段(如用户数量、负责人)需通过请求参数指定获取。
输入参数
请求头
名称 | 类型 | 必填 | 描述 |
Authorization | string | 是 | 值格式: Bearer {{access_token}} 支持鉴权类型: |
Content-Type | string | 是 | 固定值: application/json; charset=utf-8 |
路径参数
名称 | 类型 | 必填 | 描述 |
department_id | string | 是 | 部门 ID 示例值:"13580*************31" |
Query 参数
名称 | 类型 | 必填 | 描述 |
need_direct_user_count | bool | 否 | 是否返回直属用户数 示例值:false |
need_recurve_user_count | bool | 否 | 是否返回递归用户数 示例值:false |
need_manager_union_ids | bool | 否 | 是否需要部门负责人 示例值:false |
输出参数
参数名称 | 类型 | 描述 |
department_id | string | 部门 ID |
department_name | string | 部门名称 |
department_parent_id | string | 父部门 ID(根部门为 0) |
alias_id | string | 部门别名 ID |
has_child | bool | 是否存在子部门 |
manager_union_ids | array<string> | 部门负责人 union_id 列表 |
direct_user_count | int | 直属用户数 |
recurve_user_count | int | 递归用户数 |
order | int | 排序值 |
trace_id | string | 唯一请求 ID |
说明:
未显式请求 need_* 时,相关字段不返回。
示例
输入示例
GET https://api.account.tencent.com/openapi/v3/contacts/departments/13580*************31Authorization: Bearer {access_token}
输出示例
{"code": 0,"msg": "ok","trace_id": "96888c4682b1d1acd812c5cc70429b03","data": {"department": {"department_id": "13580*************31","department_name": "张三集团","has_child": true}}}
错误码
说明:
错误码 | 描述 |
201001 | 部门【%s】不存在 |
201017 | 企业部门查询失败,请重试 |
10002 | 资源不存在 |