SSH-Befehl ausführen
Führe einen einmaligen SSH-Befehl auf einem VPS aus und erhalte stdout, stderr und den Exit-Code.
Anfrage
POST /api/v1/vps/{id}/exec
Erforderlicher Scope: vps:manage
Pfadparameter
| Parameter |
Typ |
Beschreibung |
id |
string |
Die VPS-ID |
Header
| Header |
Erforderlich |
Wert |
Authorization |
Ja |
Bearer DEIN_API_SCHLÜSSEL |
Content-Type |
Ja |
application/json |
Anfragekörper
| Feld |
Typ |
Erforderlich |
Beschreibung |
command |
string |
Ja |
Shell-Befehl (max. 8192 Zeichen) |
timeout |
number |
Nein |
Timeout in Sekunden (1–300, Standard 30) |
{
"command": "uptime",
"timeout": 10
}
Antwort
{
"data": {
"exitCode": 0,
"stdout": " 14:32:01 up 12 days, 3:45, 0 users, load average: 0.00, 0.01, 0.05\n",
"stderr": "",
"durationMs": 142
}
}
Antwortfelder
| Feld |
Typ |
Beschreibung |
exitCode |
number |
Der Exit-Code des Befehls (0 = Erfolg) |
stdout |
string |
Standardausgabe |
stderr |
string |
Standardfehlerausgabe |
durationMs |
number |
Ausführungszeit in Millisekunden |
Fehler
| Status |
Code |
Beschreibung |
| 400 |
INVALID_COMMAND |
Befehl fehlt oder ist kein String |
| 400 |
COMMAND_TOO_LONG |
Befehl überschreitet 8192 Zeichen |
| 400 |
INVALID_TIMEOUT |
Timeout ausserhalb des Bereichs (1–300) |
| 404 |
NOT_FOUND |
VPS nicht gefunden oder kein Zugriff |
| 408 |
COMMAND_TIMEOUT |
Befehl hat das Zeitlimit überschritten |
| 502 |
SSH_AUTH_ERROR |
SSH-Authentifizierung fehlgeschlagen |
| 502 |
SSH_CONNECTION_ERROR |
Verbindung zum VPS nicht möglich |
Beispiel
curl -X POST "https://site.quest/api/v1/vps/699cdea2ab57a244bb5273fd/exec" \
-H "Authorization: Bearer DEIN_API_SCHLÜSSEL" \
-H "Content-Type: application/json" \
-d '{"command": "uptime", "timeout": 10}'
MCP
Diese Aktion ist auch über das exec_command MCP-Tool verfügbar.