[POST] .../v1/workschedule/setintervals
Fully replaces schedule intervals Use this method after creating a schedule or when replacing the full set of regular working intervals for a schedule. The method validates schedule_id and every interval, checks work schedule edit permission 691, marks old intervals deleted, inserts the supplied list, writes an action log record, invalidates WorkTime cache and returns row_affected with the schedule id. The request body is required, intervals must be a non-empty array, day_of_week must be 1.7, start_minute and end_minute must be valid minutes of day and cannot be equal and cross_day is normalized when an interval crosses midnight. Missing body, invalid schedule_id, empty or invalid intervals, missing schedule, denied permission and database errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| intervals | Array of WorkScheduleIntervalSet | Required | New interval list. |
| schedule_id | Int64 | Required | Schedule ID. |
Request Example
{
"schedule_id": 14,
"intervals": [
{
"day_of_week": 1,
"start_minute": 540,
"end_minute": 1080,
"cross_day": false
},
{
"day_of_week": 2,
"start_minute": 540,
"end_minute": 1080,
"cross_day": false
}
]
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Update | Update operation result. |
Response Example
{
"ok": true,
"result": {
"row_affected": 1,
"ids": [
14
]
}
}