Contents
- getEmployees Retrieve employees
- getShifts Retrieve shifts (working hours)
getEmployees Retrieve employees
Use this function to retrieve a complete or partial list of all available employees.
You can specify a syncMarker to limit the results to changed employees since a specific moment.
<?php
require_once('Mplusqapiclient.php');
$mplusqapiclient = new Mplusqapiclient();
// Initialize the client with your details.
$employeeNumbers = array();
$syncMarker = 0;
// Then we call the getEmployees() function wrapped in a try/catch block to intercept any exceptions.
try {
if (false !== ($employees= $mplusqapiclient->getEmployees($employeeNumbers,$syncMarker))) {
// Success, we show the number of retrieved employees.
exit(sprintf('Retrieved %d employees.', count($employees)));
} else {
exit('Unable to retrieve employees.');
}
} catch (MplusQAPIException $e) {
exit($e->getMessage());
}
getShifts Retrieving shifts (working hours)
<?php
require_once('Mplusqapiclient.php');
$mplusqapiclient = new Mplusqapiclient();
// Initialize the client with your details.
(...)
// Then we call the getShifts() function wrapped in a try/catch block to intercept any exceptions.
try {
if (false !== ($orders = $mplusqapiclient->getShifts($syncMarker))) {
// Success, we show the number of retrieved shifts.
exit(sprintf('Retrieved %d shifts.', count($shifts)));
} else {
exit('Unable to retrieve shifts.');
}
} catch (MplusQAPIException $e) {
exit($e->getMessage());
}