AddOn/Fehlzeitenimport/TimeTrackingAPI.php aktualisiert
This commit is contained in:
parent
a174811260
commit
7739953fe6
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue