Skip to main content

Shift Script API

Welcome to the Shift Script API documentation. This API provides functions to manage shift definitions (Shifts) and their runtime records, as well as utilities to start/stop shifts and query current status.

Function List

newShift

Creates an empty non-persisted Shifts object to provide the structure required by the API to save a new record.

getShift

Retrieves a Shifts record by its ID, or by locationIdOrPath and name.

getAllShifts

Retrieves all Shifts records in the system.

getShiftsByLocation

Retrieves all Shifts for the specified location.

getCurrentShift

Gets the current Shifts at a location, optionally at a specified timestamp.

saveShift

Creates or updates a Shifts record in the system.

validateShift

Validates a Shifts record and returns any validation errors.

deleteShift

Deletes a Shifts record by its ID.

getShiftReferences

Retrieves a list of references to a Shifts record by its ID.

getShiftStatus

Retrieves the status of a Shifts, based on its most recent record.

startShift

Starts a shift, either by shift ID or by locationIdOrPath and name; returns the created Shift Records object.

stopShift

Stops a shift, either by shift ID or by locationIdOrPath and name; returns the updated Shift Records object.

newShiftRecord

Creates an empty non-persisted Shift Records object to provide the structure required by the API to save a new record.

getShiftRecord

Retrieves a Shift Records record by its ID.

getCurrentShiftRecord

Gets the current Shift Records at a location, optionally at a specified timestamp.

getShiftRecords

Retrieves all Shift Records for a location within a time range.

saveShiftRecord

Creates or updates a Shift Records in the system.

validateShiftRecord

Validates a Shift Records record and returns any validation errors.

deleteShiftRecord

Deletes a Shift Records record by its ID.

getShiftRecordStatus

Retrieves the status of a Shift Records.

reloadStateFromDB

Reloads the Shift state from the database (re-reads trigger expressions).