Authentifizierung
API-Authentifizierung
Die Rent an Arcade API nutzt API-Key + Secret + Timestamp zur Authentifizierung. Alle Requests müssen über HTTPS laufen.
Benötigte Header
| Header | Wert | Beschreibung |
|---|---|---|
X-API-Key | ak_live_... | Dein API-Key (Dashboard → API-Zugang) |
X-Signature | Dein API-Secret | Klartext, wird serverseitig gegen bcrypt geprüft |
X-Timestamp | Unix-Timestamp | Aktueller Zeitstempel (max. 5 Minuten Abweichung, Replay-Schutz) |
PHP-Beispiel
<?php
$apiKey = 'ak_live_dein_key';
$apiSecret = 'dein_api_secret';
$baseUrl = 'https://rentanarcade.quiztreff.de/rentanarcade/api/v1/';
function raaRequest($method, $endpoint, $body = null) {
global $apiKey, $apiSecret, $baseUrl;
$url = $baseUrl . ltrim($endpoint, '/');
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . $apiKey,
'X-Signature: ' . $apiSecret,
'X-Timestamp: ' . time(),
'Content-Type: application/json',
],
]);
if ($body) curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
return json_decode(curl_exec($ch), true);
}
// Beispiel: Highscores abrufen
$scores = raaRequest('GET', 'scores?arcade_id=arc_xxx&limit=10');
print_r($scores);
Sicherheitshinweise
- Niemals API-Calls aus dem Browser senden — der Secret darf nicht im Frontend stehen
- Immer von deinem Server aus (PHP, Node.js, Python, etc.)
- Secret kompromittiert? Sofort im Dashboard rotieren.
Rate Limits
| Plan | Limit | Bei Überschreitung |
|---|---|---|
| Starter | 60 Anfragen/Minute | HTTP 429 + Retry-After Header |
| Business | 120 Anfragen/Minute | HTTP 429 + Retry-After Header |
Response-Header bei jedem Request: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset