The absence services allow you to create, get, and delete employee’s absences from third-party applications.

a) Create Absence

Create one or more employee absences by passing the Employee POS key and the absence type.

Requirements:

  • Employee POS key
  • Start date of absence
  • End date of absence
  • Absence type
  • Absence

Request (JSON)

POST /LeaveRequests/Create/?securityToken=<token>
Content-Type: application/json

   [{
     "LeaveRequestType":6,
     "PosKey":"0002",
     "FromDate":"\/Date(1467370454000)\/",
     "ToDate":"\/Date(1468148054000)\/",
     "Comment":"",
     "RequestedDate":"\/Date(1464778454000)\/",
     "Approved":null | true | false,
     "Rejected": null | true | false,
     "ApprovedDate":null,
     "NumberOfHours":null,
     "DepartmentId":<Store id> | null,
     "EmployeeLeaveRequestId":null            
     }]

Response (JSON)

HTTP/1.1 200 OK

 

b) Create/Update Sick Leave Absence Type

Create an employee sick leave by passing the EmployeePOSKey, sick leave date, leaveRequestTypeID, and a flag to indicate whether the employee is sick or not sick.

Requirements:

  • When creating an employee sick leave, the IsSick flag is required to be true, and the LeaveDate passed will be considered as the date when the employee’s sick leave starts. When the IsSick flag is passed as false, the sick leave date provided will be the date when the employee’s sick leave ends.

 

Request (JSON)

POST /LeaveRequests/CreateUpdateSickLeave/?securityToken=<token>
HTTP/1.1
Content-Type: application/json
{
    "EmployeePosKey":"1000",
    "LeaveDate":"\/Date(1467370454000)\/",
    "IsSick":true,
    "LeaveRequestTypeId":6
}

 

Response (JSON)

HTTP/1.1 200 OK

 

c) Delete an Absence 

Requirements:

  • Employee POS key
  • Sick leave start date
  • Sick leave end date
  • Absence type

Request (JSON)

POST /LeaveRequests/Delete/?posKey=0002&dateFrom=2016-07-01&dateTo=2016-07-10&leaveType=6&securityToken=<token>
Content-Type: application/json

Response (JSON)

HTTP/1.1 200 OK

 

d) Delete All Absences  

Deletes all employee absences that are related to the Employee POS key and are within a given start and end date range.

Requirements:

  • Start date and end date of absences
  • EmployeePOSKey is an optional parameter.

Request (JSON)

POST /LeaveRequests/Delete/All/?posKey=0002&dateFrom=2016-07-01&dateTo=2016-07-10&securityToken=<token>
Content-Type: application/json

Response (JSON)

HTTP/1.1 200 OK

 

e) Get All Absences by Date Range 

Get all absences that are within a given start and end date range, including overlapping absences.

Requirements:

  • Start date and end date of absences

Request (JSON)

GET /LeaveRequests/All/?startdate=2016-06-09&enddate=2016-06-10&securityToken=<token>
HTTP/1.1
Content-Type: application/json

Response (JSON)

HTTP/1.1 200 OK
[{
    "DepartmentName": "Department Name",
    "EmployeeId": " employee Id",
    "EmployeeName": "Jan Doe",
    "LeaveApproved": true,
    "LeaveEndDate": "/Date(1465596000000+0200)/",
    "LeaveRejected": false,
    "LeaveStartDate": "/Date(1465509600000+0200)/",
    "LeaveType": "Ferie"
  }]