跳到主要内容

POST 保存考勤规则

参数位置:body:id、lateGrace、earlyGrace、absentThreshold、seriousLateThreshold、maxMonthlyLate、overtimeMinimum、autoDeductLunch、weekendAsOvertime、locationRequired、wifiRequired、photoRequired。 POST 写操作。body 为 JSON 对象(整单保存,未传字段会被清空,建议先用 office.attendance.rule.detail 取回后修改再提交)。字段:id(规则ID,可选)、lateGrace(迟到宽限分钟)、earlyGrace(早退宽限分钟)、absentThreshold(旷工阈值分钟)、seriousLateThreshold(严重迟到阈值分钟)、maxMonthlyLate(每月最多迟到次数)、overtimeMinimum(最小加班分钟)、autoDeductLunch、weekendAsOvertime、locationRequired、wifiRequired、photoRequired(均为 1是/0否)。

接口编码所需范围后端接口
office.attendance.rule.saveoffice:writePOST /v1/attendance/rules/save(comap-office)

必填字段

参数说明与接口规格均未标注必填字段;以服务端校验为准,缺参时响应的 message 会指明所缺字段。 判定规则见必填字段的判定。

请求体字段(body)

字段类型必填说明
idinteger(int64)——
lateGraceinteger(int32)——
earlyGraceinteger(int32)——
absentThresholdinteger(int32)——
seriousLateThresholdinteger(int32)——
maxMonthlyLateinteger(int32)——
overtimeMinimuminteger(int32)——
autoDeductLunchinteger(int32)——
weekendAsOvertimeinteger(int32)——
locationRequiredinteger(int32)——
wifiRequiredinteger(int32)——
photoRequiredinteger(int32)——

「必填」仅反映接口规格声明的部分。服务内还有未体现在规格里的校验, 标「—」不等于可以不传;租户在主站配置的字段必填不约束本接口。 详见必填字段的判定与字段清单与自定义字段。

请求示例

curl -X POST https://open.risemap.cn/v1/api/invoke \
-H "Authorization: Bearer <访问令牌>" \
-H "Content-Type: application/json" \
-d '{
"apiCode": "office.attendance.rule.save",
"body": {}
}'

错误处理​

响应统一信封 { code, message, data },code == 200 为成功。以下是本接口可能返回的开放平台层错误:

错误码说明可重试
92101访问凭证无效否
92201接口未登记或已停用否
92202超出凭证授权范围——本接口需 office:write否
92204绑定员工无此接口的功能权限否
92203上游服务调用失败先查询处理结果,禁止盲目重试
92301请求过于频繁是
92205写操作处理超时,结果未知(下游可能仍在执行)否,先查询确认结果
92302有参数相同的写请求正在处理中等待并确认前一次结果,勿重复提交

除此之外,comap-office 自身的业务校验失败会原样透传其业务码与提示 (如字段校验、状态不允许、数据不存在),这类码不在开放平台的号段内, 以响应里的 message 为准。完整的平台层错误码见错误码说明。

← 返回考勤