33 lines
785 B
PHP
33 lines
785 B
PHP
<?php
|
|
include('TimeTrackingAPI.php');
|
|
|
|
$api = new TimeTrackingAPI(
|
|
'https://mytimeserver.de', // Base-URL
|
|
'Bearer eyJhbGciOi...', // Dein Bearer-Token
|
|
'timesvc' // API-Site
|
|
);
|
|
|
|
// 1. Verfügbare Exporte abrufen
|
|
$exports = $api->getExportDefinitions();
|
|
|
|
// 2. Organisationseinheiten abrufen
|
|
$units = $api->getOrganizationUnits();
|
|
|
|
// 3. Export starten
|
|
$guid = $api->requestExport(
|
|
'<ExportDefinitionId>',
|
|
'<OrganizationUnitId>',
|
|
'01.01.2024',
|
|
'31.01.2024'
|
|
);
|
|
|
|
// 4. Exportdaten abrufen
|
|
$data = $api->getExportData($guid);
|
|
|
|
// Ergebnis prüfen
|
|
if (isset($data['Result']) && $data['Result'] === 'JobPending') {
|
|
echo "Export läuft noch. Bitte später erneut versuchen.";
|
|
} else {
|
|
print_r($data); // Daten vorhanden
|
|
}
|