Skip to content

修改发放记录

更新发放记录的发放数量和失效日期,对应假勤管理-休假管理-发放记录

Tip: - 仅飞书人事企业版可用

  • 由系统生成的发放记录不可被更新
  • 仅可更新「发放数量」和「失效日期」

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/attendance/v1/leave_accrual_record/:leave_id
HTTP MethodPATCH
接口频率限制50 次/秒
支持的应用类型custom
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用attendance:rule 写入打卡管理规则
字段权限要求> Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID

请求头

名称类型必填描述
Authorizationstringtenant_access_token 值格式:"Bearer access_token" 示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring固定值:"application/json; charset=utf-8"

路径参数

名称类型描述
leave_idstring假期类型ID,可通过获取假期类型列表获取
示例值:"7111688079785723436"

查询参数

名称类型必填描述
user_id_typestring用户 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

请求体

名称类型必填描述
leave_granting_record_idstring发放记录的唯一ID,可通过创建假期发放记录获取
示例值:"6893014062142064135"
employment_idstring员工ID,类型对应user_id_type
示例值:"6982509313466189342"
leave_type_idstring假期类型ID,可通过获取假期类型列表获取
示例值:"7111688079785723436"
reasonlang_text\[\]修改发放记录原因
  └ langstring语言码
示例值:"zh_CN"
  └ valuestring语言码对应的文本
示例值:"test"
time_offsetint时间偏移,东八区:480 8*60
示例值:480
expiration_datestring失效日期,格式"2020-01-01"
示例值:"2020-01-01"
quantitystring修改发放数量
示例值:"1"

请求体示例

json
{
    "leave_granting_record_id": "6893014062142064135",
    "employment_id": "6982509313466189342",
    "leave_type_id": "7111688079785723436",
    "reason": [
        {
            "lang": "zh_CN",
            "value": "test"
        }
    ],
    "time_offset": 480,
    "expiration_date": "2020-01-01",
    "quantity": "1"
}

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ recordleave_accrual_record员工过期日期的发放记录
    └ idstring发放记录唯一ID
    └ employment_idstring员工ID,类型对应user_id_type
    └ leave_type_idstring假期类型ID
    └ granting_quantitystring发放数量
    └ granting_unitint发放单位,1表示天,2表示小时
    └ effective_datestring生效日期,格式为yyyy-MM-dd
    └ expiration_datestring失效日期,格式为yyyy-MM-dd
    └ granted_byint发放来源,1:系统发放;2:手动发放;3:外部系统发放
    └ reasonlang_text\[\]发放原因
      └ langstring语言码
      └ valuestring语言码对应的文本
    └ created_atstring发放记录的创建时间,unix时间戳
    └ created_bystring发放记录的创建人的ID,类型对应user_id_type
    └ updated_atstring发放记录的更新时间,unix时间戳
    └ updated_bystring发放记录的更新人的ID,类型对应user_id_type

响应体示例

json
{
    "code": 0,
    "msg": "success",
    "data": {
        "record": {
            "id": "6893014062142064135",
            "employment_id": "6982509313466189342",
            "leave_type_id": "6893014062142064135",
            "granting_quantity": "1",
            "granting_unit": 1,
            "effective_date": "2020-01-01",
            "expiration_date": "2020-01-01",
            "granted_by": 1,
            "reason": [
                {
                    "lang": "zh_CN",
                    "value": "test"
                }
            ],
            "created_at": "1687428000",
            "created_by": "6982509313466189342",
            "updated_at": "1687428000",
            "updated_by": "6982509313466189342"
        }
    }
}

错误码

HTTP状态码错误码描述排查建议
4001220016Invalid param对照接口文档的入参排查,是否漏填参数、格式错误等(例如数值参数传了字母、日期格式错误等)
4001220003Invalid effective date日期格式必须是类似“2020-01-01”
4001220001No tenant ID租户ID为空
4001220006Employment not found检查employment_id是否正确
4001220002Invalid granting unit授予单位出错
4001220004Invalid granting quantity必须是能解析成数字的字符串,例如“2.5”
4001220005Accessed data object not found检查leaveTypeID是否正确
4001220007Leave plan version not found假期计划版本数据不存在,请检查该类型的假期对应的计划配置是否创建
4001220008Error occurred while checking if the employee is eligible for the vacation plan员工不适用于假期计划版本,请检查该假期计划适用人员范围是否和员工信息匹配
4001220009Accrual rule not found检查该假期计划版本是否正确创建,是否存在有效的发放规则
4001220010Granting record already existsresponse里会带上已存在的发放记录的信息,用户可以将其取出,不需要再重试请求
5001220011Error occurred when getting employment information获取员工信息失败
5001220012An exception occurs in the database数据库异常,请联系 技术支持
5001220013Error occurred while checking if the employee is eligible for the vacation plan.检查员工是否符合假期计划适用范围时发生错误
5001220028There is an error in the unit conversion configuration in the granting rule检查假期计划版本的单位转换规则是否配置正确
5001220014Error occurred when calculating accrual record计算授予计划错误
4001220024There is a subclass for the leave type, but the subclass ID has not been passed如果假期类型存在子类,那么leaveTypeID必须传子类ID
4001220025The granting quantity range is from -9999 to 9999额度范围为-9999~9999
4001220026The number of decimal places of the granted quantity cannot exceed 6最多6位小数
4001220027The length of the granting reason cannot exceed 3000发放原因长度最多3000
4001220029The leave type has been deactivated不能往已停用的假期类型写发放记录
4001220030The length of the granted unique ID cannot exceed 64检查参数
5001229999Unknown error未知错误,请联系 技术支持
5001220015Internal error内部错误,请联系 技术支持
4001220017User not found获取员工信息失败,请检查员工ID
5001220018Invalid leave balance calculation configuration联系研发
5001220019The calculation result of leave balance is empty联系研发
4001220020When calculating the leave balance, there is no leave plan version that matches the employee检查该员工任职期间是否有对应的假期计划版本
4001220021For the leave type that is not granted according to the cycle, balance calculation is not supported不按周期发放的假期类型,不支持余额计算,联系研发
4001220022The data of the leave plan version is invalid假期计划版本数据不合法
4001220031This granting record cannot be edited or deleted该授予记录不可编辑或删除
4001220032The expiration time of this granting record is invalid更新发放记录的过期时间异常,请仔细校验下,过期时间可能小于生效时间。
4001220600通用错误信息通用错误信息包含多条,详细的错误信息以及处理建议可参见 错误信息

内容来源:飞书开放平台 · 自动爬取整理