This guide explains how to get and add leave data via API.
Before starting this tutorial make sure you have completed the Hello World tutorial.
Up to 365 days of data can be exported in a single request.
For a current range of data we recommending going back 1 month and forward for 6 months.
Step 1
Set the mk_action variable and mk_data variable.
Variable name | Values and example |
mk_action | get_leave |
mk_data | { "start_date":"2018-05-21", "end_date":"2018-05-21" } |
Step 2
Below is a list of variables that can be used to get leave data.
Variable name | Description | Required | Accepted Formats | Example |
start_date | Start of the date range | TRUE | YYYY-MM-DD | 2018-05-18 |
end_date | End of the date range | TRUE | YYYY-MM-DD | 2018-05-23 |
All leave request that overlap this date range will be returned.
Variable name | Description | Required - On insert | Formats | Example |
LRID | The unique Leave Request ID as recorded in Microkeeper | FALSE created on insert | INT | 1234 |
eusername | Unique employee username | TRUE* | Alphanumeric | john_smith |
EID | Unique Employee ID | TRUE* | INT | 1234 |
EmployeeID | Third party ID, if set by a third party system, blank if not set Unique if set | TRUE* | Alphanumeric | john_1234 |
*Either ONE of eusername, EID or EmployeeID is required | ||||
firstname | First name, as set in Microkeeper | FALSE | Alpha | John |
lastname | Last name, as set in Microkeeper | FALSE | Alpha | Smith |
type | sick = Personal leave al = Annual Leave rdo = RDO or TIL lsl = Long Service Leave off = Time off request (unpaid) com = Compassionate Leave | TRUE | Fixed List Case sensitive | sick |
start_time | Start time of leave request | TRUE | HH:MM:SS | 00:00:00 |
start_date | Start date of leave request | TRUE | YYYY-MM-DD | 2018-10-20 |
end_time | End time of leave request Use 23:59:00 to capture a whole day | TRUE | HH:MM:SS | 23:59:00 |
end_date | End time of leave request | TRUE | YYYY-MM-DD | 2018-10-20 |
status | 4 = Leave request removed by employee 5 = Leave request declined 6 = Request to remove leave request by employee 7 = Request pending approval 8 = Request accepted 9 = Request processed through payroll We recommend filtering status for 7, 8, 9 as these are likely to be processed through payroll | FALSE Default 7 | INT | 7 |
dr_cert | Doctors certificate expected with the leave request Only for sick leave requests | FALSE | Boolean | 1 |
who | The eusername of who approved the leave | FALSE | Alphanumeric | james_smith |
Successful response example
{ "success":"1", "authenticated":"1", "message":"Leave data", "data": { "leave": [{"LRID":"111518","eusername":"joel_davis","EID":"3","EmployeeID":"E3","firstname":"Joel","lastname":"Davis","type":"sick","start_time":"00:00:00","start_date":"2019-07-31","end_time":"23:59:00","end_date":"2019-08-01","status":"7","dr_cert":"1","who":""},{"LRID":"111519","eusername":"casey_murphy","EID":"21222","EmployeeID":"","firstname":"George asdfsadf asdf asd fsa","lastname":"Escabarte with really long nam","type":"sick","start_time":"00:00:00","start_date":"2019-07-31","end_time":"23:59:00","end_date":"2019-07-31","status":"9","dr_cert":"1","who":""},{"LRID":"111517","eusername":"joel_davis","EID":"3","EmployeeID":"E3","firstname":"Joel","lastname":"Davis","type":"sick","start_time":"00:00:00","start_date":"2019-07-25","end_time":"23:59:00","end_date":"2019-07-25","status":"8","dr_cert":"1","who":"joel_davis"},{"LRID":"111483","eusername":"joel_davis","EID":"3","EmployeeID":"E3","firstname":"Joel","lastname":"Davis","type":"al","start_time":"00:00:00","start_date":"2018-12-01","end_time":"23:59:00","end_date":"2019-07-31","status":"5","dr_cert":"0","who":"joel_davis"}] } }
Same example readable
Array
(
[success] => 1
[authenticated] => 1
[message] => Leave data
[data] => Array
(
[leave] => Array
(
[0] => Array
(
[LRID] => 111518
[eusername] => joel_davis
[EID] => 3
[EmployeeID] => E3
[firstname] => Joel
[lastname] => Davis
[type] => sick
[start_time] => 00:00:00
[start_date] => 2019-07-31
[end_time] => 23:59:00
[end_date] => 2019-08-01
[status] => 7
[dr_cert] => 1
[who] =>
)
[1] => Array
(
[LRID] => 111519
[eusername] => casey_murphy
[EID] => 21222
[EmployeeID] =>
[firstname] => George asdfsadf asdf asd fsa
[lastname] => Escabarte with really long nam
[type] => sick
[start_time] => 00:00:00
[start_date] => 2019-07-31
[end_time] => 23:59:00
[end_date] => 2019-07-31
[status] => 9
[dr_cert] => 1
[who] =>
)
[2] => Array
(
[LRID] => 111517
[eusername] => joel_davis
[EID] => 3
[EmployeeID] => E3
[firstname] => Joel
[lastname] => Davis
[type] => sick
[start_time] => 00:00:00
[start_date] => 2019-07-25
[end_time] => 23:59:00
[end_date] => 2019-07-25
[status] => 8
[dr_cert] => 1
[who] => joel_davis
)
[3] => Array
(
[LRID] => 111483
[eusername] => joel_davis
[EID] => 3
[EmployeeID] => E3
[firstname] => Joel
[lastname] => Davis
[type] => al
[start_time] => 00:00:00
[start_date] => 2018-12-01
[end_time] => 23:59:00
[end_date] => 2019-07-31
[status] => 5
[dr_cert] => 0
[who] => joel_davis
)
)
)
)
This feature is not yet available via the Microkeeper API, reach out to our support staff to discuss your options.