従業員休暇登録
POST
/staff/holidays
const url = 'https://api.smaregi.dev/TARGET-CONTRACT-ID/timecard/staff/holidays';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"division":"2","staffIdList":"1,2,3","holidaySettingId":"1","halfDayFlag":"0","fromDate":"2021-01-05","toDate":"2021-01-05","memo":"年末年始の休暇","holidayWorkDate":"2021-01-01"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.smaregi.dev/TARGET-CONTRACT-ID/timecard/staff/holidays \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "division": "2", "staffIdList": "1,2,3", "holidaySettingId": "1", "halfDayFlag": "0", "fromDate": "2021-01-05", "toDate": "2021-01-05", "memo": "年末年始の休暇", "holidayWorkDate": "2021-01-01" }'従業員休暇を登録します
対象
- プラン
- プレミアム
- プレミアムプラス
- エンタープライズ、旧有料
対象ユーザー権限
- 休暇管理編集
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
division
required
休暇区分
0: 通常1: 振替休日2: 代休
string
staffIdList
required
従業員IDリスト(カンマ区切りで複数指定可)
string
holidaySettingId
required
休暇設定ID
string
halfDayFlag
required
半休
半日の休暇を設定できるようにするかどうか
0: しない1: する
string
fromDate
required
休暇開始日 [YYYY-MM-DD]
string format: date
toDate
required
休暇終了日 [YYYY-MM-DD]
string format: date
memo
メモ
string
holidayWorkDate
休日出勤日 [YYYY-MM-DD]
division= 1 もしくは 2 の場合のみ
string format: date
Example
{ "division": "2", "staffIdList": "1,2,3", "holidaySettingId": "1", "halfDayFlag": "0", "fromDate": "2021-01-05", "toDate": "2021-01-05", "memo": "年末年始の休暇", "holidayWorkDate": "2021-01-01"}Responses
Section titled “Responses”登録成功
Media typeapplication/json
Array<object>
object
staffHolidayId
従業員休暇ID
string
division
休暇区分
0: 通常1: 振替休日2: 代休
string
staffId
従業員ID
string
holidaySettingId
休暇設定ID
string
halfDayFlag
半休
半日の休暇を設定できるようにするかどうか
0: しない1: する
string
toDate
休暇終了日 [YYYY-MM-DD]
string format: date
fromDate
休暇開始日 [YYYY-MM-DD]
string format: date
memo
メモ
string
holidayWorkDate
休日出勤日 [YYYY-MM-DD]
string format: date
Example
[ { "staffHolidayId": "101", "division": "2", "staffId": "1", "holidaySettingId": "1", "halfDayFlag": "0", "toDate": "2021-01-05", "fromDate": "2021-01-05", "memo": "年末年始の休暇", "holidayWorkDate": "2021-01-01" }, { "staffHolidayId": "102", "division": "2", "staffId": "2", "holidaySettingId": "1", "halfDayFlag": "0", "toDate": "2021-01-05", "fromDate": "2021-01-05", "memo": "年末年始の休暇", "holidayWorkDate": "2021-01-01" }, { "staffHolidayId": "103", "division": "2", "staffId": "3", "holidaySettingId": "1", "halfDayFlag": "0", "toDate": "2021-01-05", "fromDate": "2021-01-05", "memo": "年末年始の休暇", "holidayWorkDate": "2021-01-01" }]- 登録に失敗した場合
Media typeapplication/json
object
type
エラータイプを識別するURI、もしくはabout:blank
string
title
エラーの概要
string
detail
エラーの詳細
string
Example
{ "type": "about:blank", "title": "Bad Request", "detail": "従業員ID:1の休暇が作成できませんでした。休暇設定が存在しません。"}勤怠が締められているため、従業員休暇を登録できない場合
Media typeapplication/json
object
type
エラータイプを識別するURI、もしくはabout:blank
string
title
エラーの概要
string
detail
エラーの詳細
string
Example
{ "type": "about:blank", "title": "Conflict", "detail": "勤怠が締められているため、従業員休暇を登録できません。"}