API Endpoints
Detaillierte Dokumentation aller öffentlichen API-Endpoints
Service-Status überprüfen
Endpoint
GET /api/healthBeschreibung
Überprüft, ob der Service online ist und gibt Status-Informationen zurück. Dieser Endpoint kann für Monitoring-Zwecke verwendet werden.
Response
{
"ok": true,
"service": "craftingstudiopro-web",
"timestamp": "2024-01-15T10:30:00.000Z"
}Beispiele
const response = await fetch('https://craftingstudiopro.de/api/health');
const data = await response.json();
console.log('Service Status:', data.ok ? 'Online' : 'Offline');
console.log('Service:', data.service);
console.log('Timestamp:', data.timestamp);curl https://craftingstudiopro.de/api/healthUpdate-Check für Plugins
Endpoint
GET /api/plugins/[slug]/latestParameter
slug Der Plugin-Slug (z.B. playerdatasync)Beschreibung
Gibt die neueste Release-Version eines Plugins zurück. Ideal für automatische Update-Checks in Plugins oder anderen Anwendungen. Nur Release-Versionen werden zurückgegeben (keine Beta/Alpha).
Response (Erfolg)
{
"version": "1.2.3",
"downloadUrl": "https://example.com/plugin.jar",
"createdAt": "2024-01-15T10:30:00.000Z",
"title": "Update 1.2.3",
"releaseType": "release",
"slug": "update-1-2-3",
"pluginTitle": "PlayerDataSync",
"pluginSlug": "playerdatasync"
}Response (Fehler)
{
"error": "Plugin nicht gefunden"
}Beispiele
const response = await fetch('https://craftingstudiopro.de/api/plugins/playerdatasync/latest');
const data = await response.json();
if (response.ok) {
console.log('Neueste Version:', data.version);
console.log('Download URL:', data.downloadUrl);
console.log('Erstellt am:', data.createdAt);
} else {
console.error('Fehler:', data.error);
}curl https://craftingstudiopro.de/api/plugins/playerdatasync/latestLizenz-Keys validieren
Endpoint
POST /api/license/validateRequest Body
{
"licenseKey": "ABC-123-DEF-456",
"pluginId": "playerdatasync"
}Beschreibung
Validiert einen Lizenz-Key für ein Premium-Plugin. Gibt zurück, ob der Key gültig ist und zu welchem Plugin/User er gehört. Wichtig: Der Key wird automatisch in Großbuchstaben konvertiert, Leerzeichen werden entfernt.
Response (Gültig)
{
"valid": true,
"purchase": {
"id": "123",
"userId": "456",
"pluginId": "789",
"createdAt": "2024-01-15T10:30:00.000Z"
}
}Response (Ungültig)
{
"valid": false,
"message": "Ungültiger Lizenz-Key"
}Beispiele
const response = await fetch('https://craftingstudiopro.de/api/license/validate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
licenseKey: 'ABC-123-DEF-456',
pluginId: 'playerdatasync'
})
});
const result = await response.json();
if (result.valid) {
console.log('Lizenz ist gültig!');
console.log('Purchase ID:', result.purchase.id);
} else {
console.log('Lizenz ungültig:', result.message);
}curl -X POST https://craftingstudiopro.de/api/license/validate \
-H "Content-Type: application/json" \
-d '{"licenseKey":"ABC-123-DEF-456","pluginId":"playerdatasync"}'import java.net.HttpURLConnection;
import java.net.URL;
import java.io.*;
public class LicenseValidator {
public static void main(String[] args) {
try {
URL url = new URL("https://craftingstudiopro.de/api/license/validate");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String jsonInputString = "{\"licenseKey\":\"ABC-123-DEF-456\",\"pluginId\":\"playerdatasync\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
// Parse response...
} catch (Exception e) {
e.printStackTrace();
}
}
}Für eine allgemeine Übersicht über die API, siehe die API Übersicht.
Alle Endpoints sind öffentlich verfügbar und erfordern keine Authentifizierung. Rate Limits gelten pro IP-Adresse.