GET /api/work_time_groups
Get work-time groups list

Examples

[]
[
  {
    "id": 1,
    "name": "Swedish employees",
    "labor_agreement": {
      "working_hours_per_week": "40.0",
      "working_weekdays": [0, 1, 2, 3, 4],
      "vacation_days_per_year": 25,
      "vacation_year_start": "1970-01-01"
    },
    "long_absence_types": [
      {
        "id": 17,
        "name": "Parental leave"
      }
    ],
    "absence_approval_settings": [
      {
        "id": 51,
        "absence_type": "Vacation",
        "absence_subtype_id": null,
        "absence_subtype_name": null,
        "approval_type": "user_approver",
        "approver_ids": []
      },
      {
        "id": null,
        "absence_type": "SickLeave",
        "absence_subtype_id": null,
        "absence_subtype_name": null,
        "approval_type": "none",
        "approver_ids": []
      },
      {
        "id": 52,
        "absence_type": "LongAbsence",
        "absence_subtype_id": 17,
        "absence_subtype_name": "Parental leave",
        "approval_type": "custom_set",
        "approver_ids": [1789]
      }
    ]
  }
]

POST /api/work_time_groups
Create a work-time group

Params

Param name Description
work_time_group
required

Work-time group parameters.

Validations:

  • Must be a Hash

work_time_group[name]
required

Work-time group name. Must be unique within the company.

Validations:

  • Must be a String

work_time_group[labor_agreement_attributes]
optional

Work-time group’s labor agreement. If absent, company’s labor agreement will be used.

Validations:

  • Must be a Hash

work_time_group[labor_agreement_attributes][working_hours_per_week]
optional

N of working hours per week, e.g. 37.5.

Validations:

  • Must be a Float

work_time_group[labor_agreement_attributes][working_weekdays]
optional

Working weekdays. 0 - Mon, 1 - Tue, …, 6 - Sun. Default: [0, 1, 2, 3, 4] (meaning Mon-Fri).

Validations:

  • Must be one of: 0, 1, 2, 3, 4, 5, 6.

work_time_group[labor_agreement_attributes][vacation_days_per_year]
optional

N of vacation days per year, e.g. 25.

Validations:

  • Must be a Integer

work_time_group[labor_agreement_attributes][vacation_year_start]
optional

Vacation year start date. The year component does not matter. E.g. 1970-04-01 (meaning April 1).

Validations:

  • Must be a String

work_time_group[long_absence_types_attributes]
optional

Work-time group’s long absence types. There is no fallback to company’s long absence types.

Validations:

  • Must be an Array of nested elements

work_time_group[long_absence_types_attributes][name]
optional

Long absence type’s name. Must be unique within the work-time group.

Validations:

  • Must be a String

work_time_group[absence_approval_settings_attributes]
optional

Work-time group’s absence approval settings. Must be configured for Vacations/Sick leaves for the corresponding absence types to be created successfully. There is no fallback to company’s absence approval settings.

Validations:

  • Must be an Array of nested elements

work_time_group[absence_approval_settings_attributes][absence_type]
optional

Absence type.

Validations:

  • Must be one of: Vacation, SickLeave, LongAbsence.

work_time_group[absence_approval_settings_attributes][absence_subtype_id]
optional

Long absence type ID. Only for absence_type LongAbsence.

Validations:

  • Must be a Integer

work_time_group[absence_approval_settings_attributes][approval_type]
optional

Approval type. Default: none.

Validations:

  • Must be one of: none, user_approver, custom_set.

work_time_group[absence_approval_settings_attributes][approver_ids]
optional

Approver IDs. Only for approval_type custom_set.

Validations:

  • Must be an array of Integer


PUT /api/work_time_groups/:id
Update a work-time group

Params

Param name Description
id
required

Work-time group ID.

Validations:

  • Must be a Integer

work_time_group
required

Work-time group parameters.

Validations:

  • Must be a Hash

work_time_group[name]
required

Work-time group name. Must be unique within the company.

Validations:

  • Must be a String

work_time_group[labor_agreement_attributes]
optional

Work-time group’s labor agreement. If absent, company’s labor agreement will be used.

Validations:

  • Must be a Hash

work_time_group[labor_agreement_attributes][working_hours_per_week]
optional

N of working hours per week, e.g. 37.5.

Validations:

  • Must be a Float

work_time_group[labor_agreement_attributes][working_weekdays]
optional

Working weekdays. 0 - Mon, 1 - Tue, …, 6 - Sun. Default: [0, 1, 2, 3, 4] (meaning Mon-Fri).

Validations:

  • Must be one of: 0, 1, 2, 3, 4, 5, 6.

work_time_group[labor_agreement_attributes][vacation_days_per_year]
optional

N of vacation days per year, e.g. 25.

Validations:

  • Must be a Integer

work_time_group[labor_agreement_attributes][vacation_year_start]
optional

Vacation year start date. The year component does not matter. E.g. 1970-04-01 (meaning April 1).

Validations:

  • Must be a String

work_time_group[long_absence_types_attributes]
optional

Work-time group’s long absence types. There is no fallback to company’s long absence types.

Validations:

  • Must be an Array of nested elements

work_time_group[long_absence_types_attributes][name]
optional

Long absence type’s name. Must be unique within the work-time group.

Validations:

  • Must be a String

work_time_group[absence_approval_settings_attributes]
optional

Work-time group’s absence approval settings. Must be configured for Vacations/Sick leaves for the corresponding absence types to be created successfully. There is no fallback to company’s absence approval settings.

Validations:

  • Must be an Array of nested elements

work_time_group[absence_approval_settings_attributes][absence_type]
optional

Absence type.

Validations:

  • Must be one of: Vacation, SickLeave, LongAbsence.

work_time_group[absence_approval_settings_attributes][absence_subtype_id]
optional

Long absence type ID. Only for absence_type LongAbsence.

Validations:

  • Must be a Integer

work_time_group[absence_approval_settings_attributes][approval_type]
optional

Approval type. Default: none.

Validations:

  • Must be one of: none, user_approver, custom_set.

work_time_group[absence_approval_settings_attributes][approver_ids]
optional

Approver IDs. Only for approval_type custom_set.

Validations:

  • Must be an array of Integer


DELETE /api/work_time_groups/:id
Delete a work-time group

Params

Param name Description
id
required

Work-time group ID.

Validations:

  • Must be a Integer