获取部门列表
更新时间:2026.07.21 10:41
功能说明
查询当前租户的部门列表,可按部门编号、父部门、名称和状态筛选。
调用说明
地址:
https://www.shudacloud.com/api/open-api/platform/contacts/departments/query
方式:POST
接口编码:contacts:departments:query
鉴权方式:在请求 Header 中传入 X-API-Key。无需传入 tenant-id,服务端会根据 API Key 自动识别所属租户。
本页参数和返回值来自测试环境真实调试;请求示例中的域名已按生产环境填写。当前示例 API Key 仅在测试环境有效。
请求参数
| 名称 | 位置 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|---|
| X-API-Key | Header | String | 是 | qop_f9f5d23ff4c84e2aa513e37d08780022 | 开放平台 API Key |
| id | Body | String | 否 | ea415fa680d92b39e8b7317597d9ce55 | 部门编号 |
| parentId | Body | String | 否 | 0 | 父部门编号 |
| name | Body | String | 否 | 开放接口文档测试部门-已更新 | 部门名称,模糊匹配 |
| status | Body | Integer | 否 | 0 | 部门状态 |
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| code | Integer | 0 | 业务状态码,0 表示成功 |
| msg | String | 空字符串 | 业务提示信息 |
| data | Array | 见返回示例 | 部门列表 |
| data[].id | String | ea415fa680d92b39e8b7317597d9ce55 | 部门编号 |
| data[].name | String | 五岳剑派 | 部门名称 |
| data[].parentId | String | 0 | 父部门编号 |
| data[].leaderUserIds | Array | [] | 负责人租户成员编号列表 |
| data[].deptNum | Integer | 4 | 部门人数 |
示例
请求示例
curl --request POST \
--url "https://www.shudacloud.com/api/open-api/platform/contacts/departments/query" \
--header "X-API-Key: qop_f9f5d23ff4c84e2aa513e37d08780022" \
--header "Content-Type: application/json" \
--data '{
"id": "ea415fa680d92b39e8b7317597d9ce55"
}'
正常返回示例
{
"code": 0,
"msg": "",
"data": [
{
"id": "823493da6b902e0e8f4d4aa4928c21cd",
"name": "五岳剑派",
"parentId": "0",
"sort": 2,
"leaderUserIds": [],
"deptNum": 4,
"createTime": 1772505870221
},
{
"id": "0cf4a4ccc00e15b88452a862d60d5f76",
"name": "东岳泰山",
"parentId": "823493da6b902e0e8f4d4aa4928c21cd",
"sort": 3,
"deptNum": 2,
"createTime": 1772505877800
},
{
"id": "e929b1e870891ee164ae6b55852fd924",
"name": "西岳华山",
"parentId": "823493da6b902e0e8f4d4aa4928c21cd",
"sort": 4,
"deptNum": 0,
"createTime": 1772505889666
},
{
"id": "bf08bb9ad2778871128c6cf45703dbea",
"name": "南岳衡山",
"parentId": "823493da6b902e0e8f4d4aa4928c21cd",
"sort": 5,
"deptNum": 0,
"createTime": 1772505896671
},
{
"id": "00933192df0be5ec050f22461bc0c5ab",
"name": "北岳恒山",
"parentId": "823493da6b902e0e8f4d4aa4928c21cd",
"sort": 6,
"deptNum": 0,
"createTime": 1772505904823
},
{
"id": "36f85e15713d1ecd810c648b9e087832",
"name": "中岳嵩山",
"parentId": "823493da6b902e0e8f4d4aa4928c21cd",
"sort": 7,
"deptNum": 0,
"createTime": 1772505913521
},
{
"id": "6c34e7083b5259fa4041ed90e43e0158",
"name": "红门",
"parentId": "0cf4a4ccc00e15b88452a862d60d5f76",
"sort": 8,
"deptNum": 0,
"createTime": 1772506034345
},
{
"id": "79f1453f773a00e905161e85a7dac496",
"name": "中天门",
"parentId": "0cf4a4ccc00e15b88452a862d60d5f76",
"sort": 9,
"deptNum": 0,
"createTime": 1772506041353
},
{
"id": "05f217435a60ce28e3eae42723b9ca27",
"name": "南天门",
"parentId": "0cf4a4ccc00e15b88452a862d60d5f76",
"sort": 10,
"deptNum": 0,
"createTime": 1772506049774
},
{
"id": "fc90d76783144784840bc341a36acd8f",
"name": "十八盘",
"parentId": "0cf4a4ccc00e15b88452a862d60d5f76",
"sort": 11,
"deptNum": 0,
"createTime": 1772506056531
},
{
"id": "57a3c25dda7b73e9c434b035e2e9342a",
"name": "玉皇顶",
"parentId": "0cf4a4ccc00e15b88452a862d60d5f76",
"sort": 12,
"deptNum": 0,
"createTime": 1772506067289
},
{
"id": "b7d02fa38d93f43030fbdf8fd70f4b19",
"name": "思过崖",
"parentId": "e929b1e870891ee164ae6b55852fd924",
"sort": 13,
"deptNum": 0,
"createTime": 1772506079034
},
{
"id": "474813dd23a6cabe4901fed2c70c177a",
"name": "万寿鼎",
"parentId": "bf08bb9ad2778871128c6cf45703dbea",
"sort": 14,
"deptNum": 0,
"createTime": 1772506091814
},
{
"id": "759b40d17023c173a3226e037cf42d5e",
"name": "南岳大庙",
"parentId": "bf08bb9ad2778871128c6cf45703dbea",
"sort": 15,
"deptNum": 0,
"createTime": 1772506100347
},
{
"id": "c1136aae002db9259be3487bff8b5413",
"name": "祝融峰",
"parentId": "bf08bb9ad2778871128c6cf45703dbea",
"sort": 16,
"deptNum": 0,
"createTime": 1772506107958
},
{
"id": "ea415fa680d92b39e8b7317597d9ce55",
"name": "开放接口文档测试部门-已更新",
"parentId": "0",
"sort": 17,
"leaderUserIds": [],
"deptNum": 1,
"createTime": 1784601333547
}
]
}
常见异常
| 业务状态码 | 说明 |
|---|---|
| 400 | 请求参数格式或必填参数校验失败 |
| 1002030001 | 未传入 X-API-Key |
| 1002030002 | API Key 无效 |
| 1002030003 | API Key 已停用 |
| 1002030004 | 当前调用 IP 不在 API Key 白名单内 |
| 1002030006 | 当前 API Key 无权调用该接口 |
开放接口的业务异常通常仍返回 HTTP 200,请以响应体中的
code判断调用是否成功。