User Working Time Models
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
This module describes the API endpoints for managing working time models. A working time model represents the expected working time for an employee, starting from a given date and following a specific pattern. The system compares actual logged time against these models for reporting and balance tracking.
Valid Attributes
| Attribute | Description | Details |
|---|---|---|
| pattern | The pattern for the working time model | Must be set to weekly. |
| start_date | The date the model becomes effective | Must be set. Format: YYYY-MM-DD. |
| discarded_at | Time of removal (or null) | Cannot be set manually. Automatically set when deleted (soft-delete). |
| workdays | ||
| id | ID of the workday to update/delete | Must be set to update or delete an existing workday; if not set, a new workday will be created. |
| day_of_week | The day of the week represented by the workday | Must be set on creation, cannot be updated; must be between 0 (Monday) and 6 (Sunday) |
| seconds | The user’s target working time on the given day of week, in seconds | Must be set. |
| _delete | Indicator to delete the workday | Don’t send this parameter if you don’t want to delete the workday. Set it to true if you do. |
Relationships
The following relationships can be included in the request using the include
parameter:
| Relationship | Type |
|---|---|
| weekly_workdays | has_many |
Create
Use this endpoint to create a new working time model for a user.
Endpoint
POST /api/v1/users/:user_id/working_time_models
URL Parameters
| Parameter | Description |
|---|---|
| user_id | The ID of the user to create the working time model for |
Request
{ "data": { "type": "working_time_model", "attributes": { "pattern": "weekly", "start_date": "2025-10-01" } }}Response
{ "data": { "id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a", "type": "working_time_model", "attributes": { "pattern": "weekly", "start_date": "2025-10-01", "user_id": "c2c3a4c9-5a9e-4ad8-9b7b-9a7d6c5b2e1f", "discarded_at": null } }}List
Response
{ "data": [ { "id": "c5df543a-3324-4a48-9d26-7b92eaf97e52", "type": "working_time_model", "attributes": { ... } }, { ... } ]}This endpoint returns the user’s working time models.
HTTP Request
GET /api/v1/users/:user_id/working_time_models
Show
Response
{ "data": { "id": "54e993e0-8088-4094-99ba-4d62303483ec", "type": "working_time_model", "attributes": { ... } }}This endpoint returns a working time model.
HTTP Request
GET /api/v1/users/:user_id/working_time_models/:working_time_model_id
| Parameter | Description |
|---|---|
| user_id | The ID of the user |
| working_time_model | The ID of the working time model to return |
Update
Use this endpoint to update an existing working time model and to create/update/delete the associated workdays.
Creating/updating/deleting the associated workdays works via a
“pseudo-attribute” called workdays which can be included in the request body.
It is expected to be an array of objects with fields as described in the
“Valid Attributes” section.
Endpoint
PUT /api/v1/users/:user_id/working_time_models/:working_time_model_id
URL Parameters
| Parameter | Description |
|---|---|
| user_id | The ID of the user to update a working time model for |
| working_time_model_id | The ID of the working time model to update |
Request
{ "data": { "type": "working_time_model", "attributes": { "pattern": "weekly", "start_date": "2025-10-01", "workdays": [ { "id": "ae4d41fc-b838-4f8a-9e49-dac5b9b42a12", "seconds": 28800 }, { "id": "7d16b8e8-9140-431a-8cfb-1b6d8ff47231", "_delete": true }, { "day_of_week": 3, "seconds": 14400 } ] } }}Response
{ "data": { "id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a", "type": "working_time_model", "attributes": { "pattern": "weekly", "start_date": "2025-10-01", "user_id": "c2c3a4c9-5a9e-4ad8-9b7b-9a7d6c5b2e1f", "discarded_at": null } }}Delete
Example response:
{ "data": { "id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a", "type": "working_time_model", "attributes": { ... } }}This endpoint deletes a working time model.
HTTP Request
DELETE /api/v1/users/:user_id/working_time_models/:working_time_model_id
URL Parameters
| Parameter | Description |
|---|---|
| user_id | The ID of the user to delete a working time model from |
| working_time_model_id | ID of the working time model to delete |