通过过期时间获取发放记录
只能获取到对应时间段过期的发放记录
Tip: 仅飞书人事企业版可用
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/attendance/v1/leave_employ_expire_records/:leave_id |
| HTTP Method | GET |
| 接口频率限制 | 50 次/秒 |
| 支持的应用类型 | custom |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 | attendance:rule 写入打卡管理规则 |
| 字段权限要求 | > Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 值格式:"Bearer access_token" 示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
路径参数
| 名称 | 类型 | 描述 |
|---|---|---|
leave_id | string | 假期类型ID,可通过获取假期类型列表获取 示例值:"7111688079785723436" |
查询参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
user_id_type | string | 否 | 用户 ID 类型 示例值:open_id 可选值有: - open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID - union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? - user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? - people_corehr_id: 以飞书人事的ID来识别用户默认值: open_id当值为 user_id,字段权限要求: contact:user.employee_id:readonly 获取用户 user ID |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
employment_id | string | 是 | 员工ID,与user_id_type保持一致 示例值:"6982509313466189342" |
leave_type_id | string | 是 | 假期类型ID,可通过获取假期类型列表获取 示例值:"7111688079785723436" |
start_expiration_date | string | 是 | 失效最早日期,格式为yyyy-MM-dd 示例值:"2023-04-10" |
end_expiration_date | string | 是 | 失效最晚日期,格式为yyyy-MM-dd 示例值:"2023-05-10" |
time_offset | int | 否 | Time offset, East Eighth District: 480 = 8 * 60, if this parameter is not provided, East Eighth District is used by default 示例值:480 |
请求体示例
json
{
"employment_id": "6982509313466189342",
"leave_type_id": "7111688079785723436",
"start_expiration_date": "2023-04-10",
"end_expiration_date": "2023-05-10",
"time_offset": 480
}响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | \- | - |
└ records | leave_employ_expire_record\[\] | 员工过期日期的发放记录 |
└ id | string | 发放记录ID |
└ employment_id | string | 员工ID,与user_id_type保持一致 |
└ leave_type_id | string | 假期类型ID |
└ granting_quantity | string | 发放数量 |
└ left_granting_quantity | string | 剩余数量 |
└ granting_unit | int | 发放单位,1表示天,2表示小时 |
└ effective_date | string | 生效日期,格式为yyyy-MM-dd |
└ expiration_date | string | 失效日期,格式为yyyy-MM-dd |
└ reason | lang_text\[\] | 发放原因 |
└ lang | string | 语言码 |
└ value | string | 语言码对应的文本 |
└ is_update_by_external | boolean | 是否已经被外部系统更改过 |
└ accrual_source | int | 发放来源 可选值有: - 1: 系统发放 - 2: 人工发放 - 3: 外部系统发放 - 4: 虚拟发放 - 5: 旧系统导入 - 6: 加班转入 |
└ leave_sub_type_id | string | 假期子类型id |
└ section_type | int | 是否参与折算(1不参与折算,2参与折算)。默认不折算 |
响应体示例
json
{
"code": 0,
"msg": "success",
"data": {
"records": [
{
"id": "6893014062142064135",
"employment_id": "6982509313466189342",
"leave_type_id": "6893014062142064135",
"granting_quantity": "1",
"left_granting_quantity": "1",
"granting_unit": 1,
"effective_date": "2020-01-01",
"expiration_date": "2020-01-01",
"reason": [
{
"lang": "zh_CN",
"value": "test"
}
],
"is_update_by_external": true,
"accrual_source": 1,
"leave_sub_type_id": "6893014062142064135",
"section_type": 1
}
]
}
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 400 | 1220016 | Invalid param | 对照接口文档的入参排查,是否漏填参数、格式错误等(例如数值参数传了字母、日期格式错误等) |
| 400 | 1220003 | Invalid effective date | 日期格式必须是类似“2020-01-01” |
| 400 | 1220001 | No tenant ID | 租户ID为空 |
| 400 | 1220006 | Employment not found | 检查employmentID是否正确 |
| 400 | 1220002 | Invalid granting unit | 授予单位出错 |
| 400 | 1220004 | Invalid granting quantity | 必须是能解析成数字的字符串,例如“2.5” |
| 400 | 1220005 | Accessed data object not found | 检查leaveTypeID是否正确 |
| 400 | 1220007 | Leave plan version not found | 假期计划版本数据不存在,请检查该类型的假期对应的计划配置是否创建 |
| 400 | 1220008 | Error occurred while checking if the employee is eligible for the vacation plan | 员工不适用于假期计划版本,请检查该假期计划适用人员范围是否和员工信息匹配 |
| 400 | 1220009 | Accrual rule not found | 检查该假期计划版本是否正确创建,是否存在有效的发放规则 |
| 400 | 1220010 | Granting record already exists | response里会带上已存在的发放记录的信息,用户可以将其取出,不需要再重试请求 |
| 500 | 1220011 | Error occurred when getting employment information | 获取员工信息失败 |
| 500 | 1220012 | An exception occurs in the database | 数据库异常,请联系 技术支持 |
| 500 | 1220013 | Error occurred while checking if the employee is eligible for the vacation plan. | 检查员工是否符合假期计划适用范围时发生错误 |
| 500 | 1220028 | There is an error in the unit conversion configuration in the granting rule | 检查假期计划版本的单位转换规则是否配置正确 |
| 500 | 1220014 | Error occurred when calculating accrual record | 计算授予计划错误 |
| 400 | 1220024 | There is a subclass for the leave type, but the subclass ID has not been passed | 如果假期类型存在子类,那么leaveTypeID必须传子类ID |
| 400 | 1220025 | The granting quantity range is from -9999 to 9999 | 额度范围为-9999~9999 |
| 400 | 1220026 | The number of decimal places of the granted quantity cannot exceed 6 | 最多6位小数 |
| 400 | 1220027 | The length of the granting reason cannot exceed 3000 | 发放原因长度最多3000 |
| 400 | 1220029 | The leave type has been deactivated | 不能往已停用的假期类型写发放记录 |
| 400 | 1220030 | The length of the granted unique ID cannot exceed 64 | 检查参数 |
| 500 | 1229999 | Unknown error | 未知错误,请联系 技术支持 |
| 500 | 1220015 | Internal error | 内部错误,请联系 技术支持 |
| 400 | 1220017 | User not found | 获取员工信息失败,请检查员工ID |
| 500 | 1220018 | Invalid leave balance calculate Conf | 联系研发 |
| 500 | 1220019 | The calculation result of leave balance is empty | 联系研发 |
| 400 | 1220020 | When calculating the leave balance, there is no leave plan version that matches the employee | 检查该员工任职期间是否有对应的假期计划版本 |
| 400 | 1220021 | For the leave type that is not granted according to the cycle, balance calculation is not supported | 不按周期发放的假期类型,不支持余额计算,联系研发 |
| 400 | 1220022 | The data of the leave plan version is invalid | 假期计划版本数据不合法 |
| 400 | 1220600 | 通用错误信息 | 通用错误信息包含多条,详细的错误信息以及处理建议可参见 错误信息 |
| 400 | 1220601 | 历史错误码,不再使用 | - |
