Timesheet Management Calls
You can create and update one or more timesheet records using Timesheet Management calls. You can also use the Timesheet resource API to fetch details for one or more employees.
Endpoints
Method | Endpoint | Summary | Enterprise/Premium |
---|---|---|---|
POST | /api/v1/supervise/timesheet/start | Start an employee's timesheet | Both |
POST | /api/v1/supervise/timesheet/end | End an employee's timesheet | Both |
POST | /api/v1/supervise/timesheet/pause | Start or end an employee's break | Both |
POST | /api/v1/supervise/timesheet/approve | Approve an existing timesheet | Both |
POST | /api/v1/supervise/timesheet/discard | Discard an existing timesheet | Both |
POST | /api/v1/supervise/timesheet/update | Update an existing timesheet | Both |
GET | /api/v1/supervise/timesheet/{id}/details | View an employee's timesheet details | Both |
Fields
Body parameters | Description | DataType | Mandatory |
---|---|---|---|
intTimesheetId | Unique internal identifier of the Timesheet | Integer | Yes |
intEmployeeId | Unique internal identifier of the Employee | Integer | Yes |
IntOpunitId | Unique internal identifier of the Departments | Integer | TYes |
intStartTimestamp | Unix timestamp for the start of the Timesheet | Integer | Yes |
intEndTimestamp | Unix timestamp for the end of the timesheet | Integer | Yes |
intRosterId | Unique internal identifier of the Roster | Integer | No |
strComment | Comments attached to the timesheet | String | No |
strDate | Date to associate to the Timesheet (instead of providing Unix timestamps) | Date | No |
intStartTimeHour | Start Hour (instead of providing unix timestamps) | Integer | No |
intStartTimeMinute | Start Minute (instead of providing unix timestamps) | Integer | No |
intEndTimeHour | End Hour (instead of providing unix timestamps) | Integer | No |
intEndTimeMinute | End minute (instead of providing unix timestamps) | Integer | No |
intMealbreakMinute | Total number of minutes as an undefined mealbreak | Integer | No |
arrSlots | Array of specifically defined mealbreaks | String | No |
blnIsInprogress | Value that represents if the timesheet is currently in progress | Boolean | No |
blnApproveTimesheet | Value that represents if timesheet should be set as approved | Boolean | No |
Start an employee's timesheet
URL
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/start'
Sample payload
{
intEmployeeId: 3,
intMealbreakMinute: 30
}
End an employee's timesheet
URL
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/end'
The below example is used when attempting to conclude an employee's timesheet and allocate a 30-minute undefined mealbreak.
Sample payload
{
intTimesheetId: 3,
intMealbreakMinute: 30
}
Update or Create a given employee's timesheet
This call allows you to create a new Timesheet Record in Deputy using unix timestamps, defined mealbreak slots and associate it to an employee.
URL
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/update'
Sample payload
{
intEmployeeId: 1,
intOpunitId: 2,
intStartTimestamp: 1616360400,
intEndTimestamp: 1616382000,
arrSlots: [{
"blnEmptySlot": false,
"strType": "B",
"intStart": 7200,
"intEnd": 9000,
"intUnixStart": 1616367600,
"intUnixEnd": 1616369400,
"mixedActivity": {
"intState": 2,
"blnCanStartEarly": 1,
"blnCanEndEarly": 1,
"blnIsMandatory": 1,
"strBreakType": "M"
},
"strTypeName": "Meal Break",
"strState": "Finished"
}, {
"blnEmptySlot": false,
"strType": "B",
"intStart": 14400,
"intEnd": 15300,
"intUnixStart": 1616374800,
"intUnixEnd": 1616375700,
"mixedActivity": {
"intState": 2,
"blnCanStartEarly": 1,
"blnCanEndEarly": 1,
"blnIsMandatory": 1,
"strBreakType": "R"
},
"strTypeName": "Rest Break",
"strState": "Finished"
}]
}
The below sample is an example of updating an existing timesheet record in Deputy
{
intTimesheetId: 1,
intStartTimestamp: 1616360400,
intEndTimestamp: 1616382000,
intOpunitId: 2,
strComment: "This timesheet was recently updated via the API"
}
Pause, Approve or Discard a given employee's timesheet
The following examples show how to start/end an employee's break, approve or discard an associated timesheet.
URLS
Pause
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/pause'
Approve
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/approve'
Discard
curl --location -g --request POST 'https://{install}.{geo}.au.deputy.com/api/v1/supervise/timesheet/discard'
Sample payload
{
intTimesheetId: 12
}
Status Responses
Code | Status | Description |
---|---|---|
200 | OK | The request was successfully completed and the JSON response contains the timesheet object |
400 | Bad Request | $ExceptionMessage |
400 | Bad Request | Unable to update your shift |
400 | Bad Request | Invalid Photo does not exist |
400 | Bad Request | Invalid LoginEmp is not active |
400 | Bad Request | INVALID ActionString is given |
400 | Bad Request | EndTime cannot be in the future |
400 | Bad Request | Sorry, you cannot submit a future timesheet |
400 | Bad Request | Sorry, the submitted timesheet does not exist |
400 | Bad Request | Sorry, you must set the area for the timesheet |
400 | Bad Request | Timesheet start time must not be in the future |
400 | Bad Request | INVALID given employee is not your subordinate |
400 | Bad Request | INVALID timesheet not found or cannot be modified |
400 | Bad Request | You are not allowed to clock in/out on this device |
400 | Bad Request | Sorry, this action was not possible to be completed |
400 | Bad Request | Sorry, you can not start another break when there is a break in place |
400 | Bad Request | Referenced roster does not exist or assigned employee has been changed |
400 | Bad Request | Sorry, the selected area is not legal for submitting timesheet. Please contact your supervisor. |
401 | Unauthorized | You are not allowed to edit this timesheet |
409 | Conflict | You already have another timesheet in progress |
412 | Precondition Failed | You are not allowed to edit this timesheet |
412 | Precondition Failed | Timesheet has been discarded by the supervisor |
412 | Precondition Failed | Your timesheet is no longer in progress so cannot be submitted |
412 | Precondition Failed | Cannot pause timesheet as you do not have an in-progress timesheet |
500 | Internal Server Error | Unknown Error. Please contact support for assistance. |
Updated about 2 years ago