部门
获取组织部门架构
复用现有的【组织-查找部门】
鉴权方式
个人访问令牌(PAT)由用户自行创建,用于以个人身份调用 API。
版本
请求地址
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
Authorization | string | 是 | Bearer {{access_token}} |
HAP-Appid | string | 否 | 应用 id |
Query 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
orgId | string | 否 | 组织ID,OAuth/PAT 鉴权不传 HAP-Appid 时必填,用于指定查询组织;传入 HAP-Appid 时可省略。 |
响应参数
200成功| 名称 | 类型 | 描述 |
|---|---|---|
success | boolean | 是否调用成功 |
error_code | integer | 错误代码 |
error_msg | string | 错误消息 |
data | object[] | 部门列表 |
data.id | string | 部门ID |
data.name | string | 部门名称 |
data.parentId | string | 父级部门ID |
data.path | string | 部门路径,格式:“最高级部门名称/.../ 父部门名称” |
data.chargeUsers | object[] | 部门负责人列表 |
data.chargeUsers.accountId | string | 用户ID |
data.chargeUsers.fullname | string | 姓名 |
data.children | object[] | 子部门列表 |
curl -X GET "https://example.com/v3/departments"{ "success": true, "data": [ { "id": "dep_001", "name": "部门A", "path": "公司/部门A", "parentId": "dep_000", "chargeUsers": [ { "accountId": "user_001", "fullname": "Alice" } ], "children": [ { "id": "dep_002", "name": "部门A", "path": "公司/部门A", "parentId": "dep_001", "chargeUsers": [ { "accountId": "user_001", "fullname": "Alice" } ], "children": [] } ] } ], "error_code": 1}