创建部门
POST
/open-apis/contact/v3/departments
自建应用商店应用
只可在应用的通讯录权限范围内的部门下创建部门。若需要在根部门下创建子部门,则应用通讯录权限范围需要设置为“全部成员”。应用商店应用无权限调用此接口。
错误码
HTTP状态码 | 错误码 | 描述 | 排查建议 |
---|---|---|---|
400 | 43005 | duplicate order error | 部门的order必须唯一,请检查后重试。 |
400 | 40018 | param error | 参数错误 |
400 | 43008 | custom dept id invalid error | 部门自定义ID不合法,不得以od-开头,不能为“0”,长度不可超过64。 |
400 | 43013 | dept too many children error | 子部门数量过多。 |
400 | 40003 | internal error | 内部错误,请提供 X-Request-Id向客服反馈。联系客服。 |
403 | 40004 | no dept authority error | 操作的部门需在通讯录权限范围中,了解更多 |
400 | 40008 | dept Info is null error | 部门的信息不能为空 |
400 | 40010 | chat id is invalid error | 部门群ID格式错误。 |
403 | 40014 | no parent dept authority error | 没有父部门权限(组织架构可见范围权限)。 |
401 | 43000 | dept has already exist error | 创建的部门已经存在。 |
401 | 40016 | dept name can not be nul error | 部门名不能为空。 |
400 | 42006 | user has resigned error | 用户已经离职。 |
400 | 41012 | user id invalid error | 用户ID无效。 |
400 | 40021 | no a same request error | 两次操作不是同一个请求,请检查request值是否有改动。 |
400 | 43004 | illegal unit error | 部门unit id无效。 |
400 | 43007 | duplicated department custom id error | 部门自定义ID 企业内重复 |
403 | 40004 | no dept authority error | 操作的部门需在通讯录权限范围中,了解更多 |
400 | 44101 | miss parent department id error | 请求缺少 parent department id |
400 | 43017 | relate dept over limit | 关联部门超过限制 |
400 | 43018 | duplicate i18n name | 重复的i18n名字 |
400 | 43019 | exceed dept max level | 超过部门层级深度 |
400 | 43021 | department chat not exist | 部门群不存在 |
400 | 43022 | department name duplicate | 部门名重复 |
400 | 43023 | dept structure no permissione | 组织架构没有权限 |
400 | 43024 | dept structure tenant lock fail | 部门结构变动获取租户锁失败 |
400 | 43025 | top department leader unjoined | 用户未加入不能成为企业负责人 |
400 | 43026 | employee type is not valid | 请使用准确的雇员类型 |
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://open.feishu.cn/open-apis/contact/v3/departments' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "DemoName",
"i18n_name": {
"zh_cn": "Demo名称",
"ja_jp": "デモ名",
"en_us": "Demo Name"
},
"parent_department_id": "D067",
"department_id": "D096",
"leader_user_id": "ou_7dab8a3d3cdcc9da365777c7ad535d62",
"order": "100",
"unit_ids": [
"custom_unit_id"
],
"create_group_chat": false
}'
响应示例响应示例
{
"code": 0,
"msg": "success",
"data": {
"department": {
"name": "DemoName",
"i18n_name": {
"zh_cn": "Demo名称",
"ja_jp": "デモ名",
"en_us": "Demo Name"
},
"parent_department_id": "D067",
"department_id": "D096",
"open_department_id": "od-4e6ac4d14bcd5071a37a39de902c7141",
"leader_user_id": "ou_7dab8a3d3cdcc9da365777c7ad535d62",
"chat_id": "oc_5ad11d72b830411d72b836c20",
"order": "100",
"unit_ids": [
"custom_unit_id"
],
"member_count": 100,
"status": {
"is_deleted": false
}
}
}
}
请求参数
Query 参数
user_id_type
可选
示例值:
open_id
department_id_type
可选
示例值:
open_department_id
client_token
可选
示例值:
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
Header 参数
Authorization
string
必需
默认值:
Bearer {{access_token}}
Content-Type
string
必需
默认值:
application/json; charset=utf-8
Body 参数application/json
返回响应
修 改于 2023-01-12 05:46:39