Shift Templates : Get, Create

Shift Template Settings Via Web Portal

The Schedule Cycle must be set and known before you can understand which integer and string values to set for startDayIndex and startDayLabel respectively.

0a6dfa80-e19c-4543-8196-921484241cf0#media-blob-url=true&id=96f35835-6b4b-4853-ac78-a5dcd03d6f2d&contextId=73631&collection.png

Via the API

Shift Template Settings are accessible via the dedicated action on the /clients endpoint:

/clients/{id}/actions/set-shift-template-settings

image-20230424-191547.png

Shift Templates - [GET]

Example 1
Schedule Cycle: 7
First Period Start Date: 2020-07-29
2020-07-29 = Wednesday
Template created to Wednesday

Mapping
0 = WEDNESDAY
1 = THURSDAY
2 = FRIDAY
3 = SATURDAY
4 = SUNDAY
5 = MONDAY
6 = TUESDAY
-1 = CLOSED

[GET]/rest/v1/shift-templates/3732

8baf08fa-3b67-46e6-ab8f-ffceda213b3a#media-blob-url=true&id=fa9c5029-d323-4c84-8821-c15664f0937e&contextId=73631&collection.png

Example 2
Schedule Cycle: 7
First Period Start Date: 2020-07-26
2020-07-26 = SUNDAY
Template created to Wednesday
 

Mapping

0 = SUNDAY
1 = MONDAY
2 = TUESDAY
3 = WEDNESDAY
4 = THURSDAY
5 = FRIDAY
6 = SATURDAY
-1 = CLOSED

[GET]/rest/v1/shift-templates/3733

33c3c8fb-b416-4ac0-9b4d-46310a64e7ba.png

Example 3
Schedule Cycle: 14
First Period Start Date: 2020-07-26
2020-07-26 = SUNDAY
2 Templates created, the first one to the first Wednesday and the other one to the second Wednesday

Mapping

0 = EVERY_1_SUNDAY            7  = EVERY_2_SUNDAY
1 = EVERY_1_MONDAY           8  = EVERY_2_MONDAY
2 = EVERY_1_TUESDAY           9  = EVERY_2_TUESDAY
3 = EVERY_1_WEDNESDAY   10 = EVERY_2_WEDNESDAY  
4 = EVERY_1_THURSDAY      11 = EVERY_2_THURSDAY
5 = EVERY_1_FRIDAY            12 = EVERY_2_FRIDAY
6 = EVERY_1_SATURDAY      13 = EVERY_2_SATURDAY
-1 = CLOSED

[GET]/rest/v1/shift-templates?id:in=3734,3735

7437ea56-c2e4-48f8-b454-fc3f93fcf32f.png

Example 4
Schedule Cycle: 3 (custom)
First Period Start Date: 2020-07-26
2020-07-26 = SUNDAY
Template created to the day 1

Mapping

0 = DAY_1
1 = DAY_2
2 = DAY_3
-1 = CLOSED

[GET]/rest/v1/shift-templates/3737

3c6bed5c-bd81-43fd-afb2-24880fd4ffc1.png

Shift Templates - [POST]

When importing a Shift Template it’s important to remember that the template will create shifts from the startDate value set in the Shift Template Settings (see the first section above of this document) when running the action:

/clients/{id}/actions/set-shift-template-settings

Examples

Schedule Cycle: 14
First Period Start Date: 2020-07-29
2020-07-29 = Wednesday

[POST]/rest/v1/shift-templates

Payload:

{
   "position": 59,
   "startTime": "09:00:00",
   "endTime": "17:00:00",
   "startDayIndex": 10,
   "vacant": true         or    "employee": {employee_id}
}

Response:

1b608d12-5264-4611-91d9-eb57a0e47f10.png

Validation group: employee, vacant, onShiftBoard

There is a validation group where depending on the true/false values of vacant and onShiftBoard, the employee field becomes necessary to include in payloads when POSTing a shift-template.

If the vacant field is omitted, false is assumed and employee will be required for example. So be sure to include:

"vacant" : true

 

 

Was this article helpful?
0 out of 0 found this helpful

Articles in this section