How to Create a new Break Rule
You can create a new Break Rule without assigning it to a position, and without defining its conditions. But if you’d like to define conditions and assign to one or more positions at the same time, you need to know some additional ID numbers like that of Positions, and some break ENUMs like those of “type” and “offsetType”.
The “name” you give the Break Rule must be unique for the Region defined in the payload.
The list of Positions IDs can be an array of JSON containers, or an array of integers:
"positions": [
{"id": 382},
{"id": 388}
],
OR
"positions": [382,388],
When assigning a new Break Rule to a position at time of creation, it will replace the previously assigned Break Rule.
Identify the type of break, either REST or MEAL. These are uppercase enums.
Identify which offsetType, either SPECIFIC_TIME or ANYTIME.
The duration, offset start and end values are in minutes. I believe the offset start must be equal to or larger than the value of duration. (to validate)
Here’s an example JSON payload of how to post a new Break Rule, that targets two positions, and is based on a single Break Rule Condition Model (that will be created at the end of the process of the Break Rule being created):
[POST] /break-rules
{
"name": "AB Break Rule",
"positions": [
{"id": 382},
{"id": 388}
],
"conditions": [
{
"type": "REST",
"duration": 5,
"offsetType": "SPECIFIC_TIME",
"offsetStart": 2,
"offsetEnd": 0,
"hasReminder": "YES",
"reminderMinutes": 1,
"status": "ACTIVE",
"requiresAcknowledgement": "NO"
}
],
"region": 2,
"effectiveDate" : "2022-10-01",
"status": "ACTIVE"
}
Results
New Break Rule
{
"name": "AB Break Rule",
"status": "ACTIVE",
"region": 2,
"effectiveDate": "2022-10-01T00:00:00+00:00",
"id": 37
}
Position(s) updated
{
"name": "AB Guard",
"description": "",
"customId": "UA-1",
"status": "ACTIVE",
"account": 687,
"contract": 135,
"nonBillable": false,
"shiftMemo": "",
"beginDate": "2022-08-01T00:00:00+00:00",
"endDate": null,
==> "breakRule": 37,
"taxClass": null,
"payCodeLabel": null,
"id": 382
}
New Break Rule Condition
{
"breakRule": 37,
"type": "REST",
"duration": 5,
"offsetType": "SPECIFIC_TIME",
"offsetStart": 2,
"offsetEnd": 0,
"hasReminder": "YES",
"reminderMinutes": 1,
"status": "ACTIVE",
"requiresAcknowledgement": "NO",
"id": 40
}
Assign an Existing Break Rule to one or more Positions
[POST] /break-rules/{id}/assign
{
"positions" : [id1, id2, ... idn]
}