Work Sessions (starting and stopping via API)

Introduction

Shifts (Work Sessions) are intervals of time for performing work. They have a data dependency on the following:

  • A Shift
  • A Position
  • A Client site
  • An Employee
  • A Clock-In Method

Business Rules

Clock in restrictions

  • Reject clock-in when LAT and LONG do not match
  • Reject when an employee is not assigned to a location.
  • Allow and generate an exception when an employee is clocked in from outside the LAT and LON.

Clock out restrictions

  • No restrictions to clock out are set in the system.

Managed vs unmanaged breaks

  • Break notice for breaks to be taken and reminder.

Break compliance

  • The break summary at the end of the shift will be shared from the app only. The employee will acknowledge the details of the records.

Clock IN/OUT Methods

MethodContext
LIVEWork session is either in progress or is a continuous shift
DEVICEClocked in/out using the Mobile Application
ADMINClocked in/out by an Admin
PHONEClocked in/out on IVR
BROWSERClocked in/out on Onsite license
BATCHClocked out by System Auto Clock out or Clocked in via Batch interface
KIOSKClocked in/out on the Kiosk
SHIFT_APPClocked in/out manually via the TT-Shift mobile application.
GUARD_APPClocked in/out manually via the Guard Tour mobile application.
APICreated/edited via API.
DELAYED 
SYSTEMWhen an employee clocks in to a shift but doesn't clock out, the system auto-clocks them out after a certain time (after their scheduled shift ends or through inactivity.)

Starting a Shift (Work Session)

Once the unique IDs and Method (ENUM) are known, a Work Session can be created that links to them, and causes the Shift to enter a status of "Working" (web UI term) and "OPEN" (API term):

[POST] /work-sessions

{
  "startedOn": "2022-12-16 15:17:00",
  "clockInMethod": "API",
  "status": "OPEN",
  "employee": 1053,
  "shift": 100594,
  "position": 382,
  "account": 687
}

The success of this posting of new work session data will then become visible in the TrackTik web portal under the shift tool-tip, and the log in the Dashboard: 

PG7nJB_u6ZI976Q8v3U7bL-XDoPh_gtmXq5vLLgJL8Ve230u8SFsQ-HqOrZO3biOHrnz-qlcYMt7psD3Ui6SgyjpexRGdnn-UgoUG4Rg5qJTQFAUOhWZNyE1MZkLtOFwjNZQU9bhPeqFCe43kPds2B4taLA8EzoRmv-rqoY9kwHZEB-qtb1Nuxer_Ne4_Q.png

2024-06-25 14_02_43-Work Sessions (starting and stopping via API) - Developer Relations - Confluence.png

The response will contain information about the now active Work Session, most importantly the Work Session's ID, which will need to be known to end the shift via API call as well:

{
        "startedOn": "2022-12-16T15:17:00+00:00",
        "endedOn": null,
        "startDateTime": "2022-12-16T15:17:00+00:00",
        "endDateTime": null,
        "initiationMethod": "API",
        "clockInMethod": "API",
        "terminationMethod": "LIVE",
        "clockOutMethod": "LIVE",
        "status": "OPEN",
        "employee": 1053,
        "shift": 100594,
        "position": 382,
        "account": 687,
   ⇒    "id": 4592
    }

Ending a Shift (Work Session)

To end an active Shift, you only need to call the action to end it using the unique ID of the Work Session created earlier and by specifying what the Cloud Out Method is:

[POST] /work-sessions/4592/actions/clock-out

{
   "clockOutMethod": "API"
}

Visibility in the TrackTik web application:

2024-06-25 14_04_21-Work Sessions (starting and stopping via API) - Developer Relations - Confluence.png

Now the Work Session will contain all data connected to start and stop methods and times, along with a status of "CLOSED":

{
        "startedOn": "2022-12-16T15:17:00+00:00",
        "endedOn": "2022-12-16T20:39:43+00:00",
        "startDateTime": "2022-12-16T15:17:00+00:00",
        "endDateTime": "2022-12-16T20:39:43+00:00",
        "initiationMethod": "API",
        "clockInMethod": "API",
        "terminationMethod": "API",
        "clockOutMethod": "API",
        "status": "CLOSED",
        "employee": 1053,
        "shift": 100594,
        "position": 382,
        "account": 687,
        "id": 4592
    }
Was this article helpful?
0 out of 0 found this helpful

Articles in this section