AddOn/Fehlzeitenimport/TimeTrackingAPI.php aktualisiert

This commit is contained in:
olaf.braun 2025-06-25 21:52:25 +02:00
parent a174811260
commit 7739953fe6
1 changed files with 14 additions and 2 deletions

View File

@ -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;
}
}