SetUsers
[POST] .../v1/workscheduleassignment/setusers
Assigns schedules to users Use this method to assign schedules directly to users after creating or selecting the target schedule. The method validates the non-empty assignments array, validates each user_id, schedule_id, date_from and optional date_to, checks permission 694, verifies that every schedule exists, deactivates existing active assignments for each user, inserts the new assignments, writes action log entries and returns row_affected with created assignment ids. The request body is required, date_from and date_to use account date format and date_to cannot be earlier than date_from. Missing body, empty assignments, invalid ids or dates, missing schedule, denied permission and database errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| assignments | Array of WorkUserScheduleSetItem | Required | User assignment list. |
Request Example
{
"assignments": [
{
"user_id": 10,
"schedule_id": 14,
"date_from": "2026-03-01",
"date_to": null
}
]
}
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": [
41
]
}
}