API
API Dokumentation
Integriere CraftingStudio Pro in deine Anwendungen
Übersicht
Die CraftingStudio Pro öffentliche API ermöglicht es dir, programmatisch auf unsere Plattform zuzugreifen. Alle Endpoints sind öffentlich verfügbar und erfordern keine Authentifizierung.
Base URL:
https://craftingstudiopro.de/api Format:
Alle Responses sind im JSON-Format.
Verfügbare Endpoints
Health Check
GET
/api/healthPrüft, ob der Service online ist
Response:
{ ok: boolean, service: string, timestamp: string }Plugins
GET
/api/plugins/[slug]/latestNeueste Release-Version eines Plugins (für Update-Checks)
Parameter:
slug - Der Plugin-Slug (z.B. playerdatasync)Response:
{ version: string, downloadUrl: string, createdAt: string | null, title: string, releaseType: "release", slug: string | null, pluginTitle: string, pluginSlug: string }Lizenzen
POST
/api/license/validateValidiert einen Lizenz-Key für ein Plugin
Body:
{ licenseKey: string, pluginId: string | number }Response:
{ valid: boolean, message?: string, purchase?: { id: string, userId: string, pluginId: string, createdAt: string } }Beispiel Request
Health Check (JavaScript):
// Health Check
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); Health Check (cURL):
curl https://craftingstudiopro.de/api/health Update-Check (JavaScript):
// Prüfe auf Updates für ein Plugin
const response = await fetch('https://craftingstudiopro.de/api/plugins/playerdatasync/latest');
const latest = await response.json();
if (latest.version !== currentVersion) {
console.log('Update verfügbar:', latest.version);
console.log('Download:', latest.downloadUrl);
} Update-Check (cURL):
curl https://craftingstudiopro.de/api/plugins/playerdatasync/latest Lizenz-Validierung (JavaScript):
// POST Request für Lizenz-Validierung
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' // oder pluginId: 123
})
});
const result = await response.json();
if (result.valid) {
console.log('Lizenz ist gültig!');
} else {
console.log('Lizenz ungültig:', result.message);
} Lizenz-Validierung (cURL):
curl -X POST https://craftingstudiopro.de/api/license/validate \
-H "Content-Type: application/json" \
-d '{"licenseKey":"ABC-123-DEF-456","pluginId":"playerdatasync"}'Rate Limits
Um Missbrauch zu verhindern, haben wir Rate Limits implementiert:
- Öffentliche API: 100 Requests pro Stunde pro IP-Adresse
Bei Überschreitung erhältst du einen 429 Too Many Requests Status Code.