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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?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()); } |