启用/停用公司
对公司进行启用或停用操作
Tip: 停用公司时请确认有无在职员工、异动单据、待入职单据关联此公司,如有会导致停用失败。
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/corehr/v2/companies/active |
| HTTP Method | POST |
| 接口频率限制 | 5 次/秒 |
| 支持的应用类型 | custom,isv |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 | corehr:company:write 查看、创建、更新、删除公司信息 |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 值格式:"Bearer access_token" 示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
company_id | string | 是 | 公司 ID - 可从 批量查询公司的 id 字段中获取。 示例值:"1616161616" |
effective_time | string | 是 | 公司启用/停用生效时间 - 填写格式: YYYY-MM-DD - 系统默认为填写日期当天的 00:00:00 生效 - 该接口只支持到最小单位为日 - 日期范围要求:1900-01-01 ~ 9999-12-31 示例值:"2020-01-01" |
active | boolean | 是 | 启用/停用状态。 - active 传 true 代表启用 - active 传 false 代表停用 示例值:true |
operation_reason | string | 是 | 操作原因 示例值:"业务操作" |
请求体示例
json
{
"company_id": "1616161616",
"effective_time": "2020-01-01",
"active": true,
"operation_reason": "业务操作"
}响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | \- | - |
响应体示例
json
{
"code": 0,
"msg": "success",
"data": {}
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 400 | 1160402 | param is invalid | 检查传参是否正确 |
| 400 | 1160267 | Activation date cannot be earlier than the effeective date of the last deactivated version | 启用日期不能早于最新的停用日期 |
| 400 | 1160268 | Effective date for disabling can't be earlier than theeffective date of the last version | 停用日期不能早于最新的启用日期 |
| 400 | 1160350 | Failed to enable. Its parent has been deactivated on | 启用失败,上级公司已停用 |
| 400 | 1160501 | Failed to disable this as it still has sub after the deactivation effective time | 停用日期下仍有启用的下级 |
| 400 | 1160072 | Unable to deactivate, because there are still active contracts or employees or pre-hires in it since effective time | 停用失败,停用日期仍有关联此公司的合同记录、在职员工和待入职员工 |
| 400 | 1160281 | Failed to disable as 1 or more members of it are in a job status change process after the current deactcivation date | 停用失败,停用日期仍有关联此公司的异动记录 |
| 503 | 1161204 | Requset timeout | 请求超时,请稍后重试。必要时请联系飞书人事 Oncall |
| 429 | 1161604 | QPS over limit | 请求频率过高,请稍后重试。必要时请联系飞书人事 Oncall |
