diff --git a/AddOn/Fehlzeitenimport/TimeTrackingAPI.php b/AddOn/Fehlzeitenimport/TimeTrackingAPI.php index c405bfd0..57a3e4c8 100644 --- a/AddOn/Fehlzeitenimport/TimeTrackingAPI.php +++ b/AddOn/Fehlzeitenimport/TimeTrackingAPI.php @@ -71,8 +71,20 @@ class TimeTrackingAPI return $response['Result'] ?? throw new RuntimeException('Unexpected response: ' . json_encode($response)); } - public function getExportData(string $guid): array + public function getExportData(string $guid): array|string { - return $this->request('GET', "api/export/{$guid}"); + $url = "api/export/{$guid}"; + + $response = $this->rawRequest('GET', $url); + + // Versuche, JSON zu dekodieren + $decoded = json_decode($response, true); + + if (json_last_error() === JSON_ERROR_NONE) { + return $decoded; + } + + // Kein JSON – gib den Rohinhalt zurück (CSV, Text etc.) + return $response; } }