-
Notifications
You must be signed in to change notification settings - Fork 1
API Endpoints
This document provides a comprehensive reference for the UltimateServer API.
Most API endpoints require authentication using JWT tokens. To obtain a token, use the login endpoint:
Authenticate a user and get a JWT token.
Request Body:
{
"username": "admin",
"password": "admin123",
"rememberMe": true
}Response:
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "dGhpcy1pcy1hLXJlZnJlc2gtdG9rZW4...",
"user": {
"username": "admin",
"role": "admin",
"email": "admin@example.com"
}
}Register a new user.
Request Body:
{
"username": "newuser",
"email": "user@example.com",
"password": "StrongPassword123!",
"role": "player"
}Response:
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "dGhpcy1pcy1hLXJlZnJlc2gtdG9rZW4...",
"user": {
"username": "newuser",
"role": "player",
"email": "user@example.com"
}
}Request a password reset link to be sent to an email.
Request Body:
{
"email": "user@example.com"
}Response:
{
"success": true,
"message": "If an account with that email exists, a password reset link has been sent."
}Confirm a password reset using a token.
Request Body:
{
"email": "user@example.com",
"token": "the-reset-token-from-email",
"newPassword": "NewStrongPassword123!"
}Response:
{
"success": true,
"message": "Password has been reset successfully."
}Get basic server statistics (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"uptime": "04:15:30",
"users": 2,
"maxConnections": 100,
"protocol": 1
}Get detailed system performance data (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"cpuUsage": 12.3,
"memoryMB": 1024.5,
"diskUsedGB": 250.0,
"diskTotalGB": 500.0,
"netSentMB": 1024.5,
"netReceivedMB": 2048.8
}Get recent server logs (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
[
"2023-10-27 10:00:00 [Info] Server started successfully",
"2023-10-27 10:01:00 [Warning] High memory usage detected",
"2023-10-27 10:02:00 [Error] Failed to connect to database"
]Get a list of all loaded plugins (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"success": true,
"plugins": [
{
"id": "MyAwesomePlugin",
"name": "My Awesome Plugin",
"version": "1.0.0",
"enabled": true
}
]
}Upload a new plugin file (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>
Content-Type: multipart/form-dataRequest Body:
file: <plugin.dll>Response:
{
"success": true,
"message": "Plugin uploaded and reloaded successfully."
}Triggers a scan and reload of all plugins in the plugins directory (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"success": true,
"message": "Plugins reloaded successfully."
}Get a list of plugins available from the marketplace (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"success": true,
"plugins": [
{
"name": "CoolPlugin",
"description": "A very cool plugin.",
"downloadLink": "https://example.com/CoolPlugin.dll"
}
]
}Queue a plugin for download from the marketplace (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Request Body:
{
"name": "CoolPlugin",
"downloadLink": "https://example.com/CoolPlugin.dll"
}Response:
{
"success": true,
"message": "Download request for 'CoolPlugin.dll' has been queued and will be processed."
}Get a list of all managed sites (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"MySite": {
"Name": "MySite",
"Port": 8080,
"RootPath": "/path/to/my/site"
}
}Create a new site (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Request Body:
{
"name": "NewSite",
"port": 8081
}Response:
{
"success": true,
"message": "Site created successfully"
}Delete an existing site (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Request Body:
{
"name": "OldSite"
}Response:
{
"success": true,
"message": "Site deleted successfully"
}Get a list of running process names (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
{
"processesName": [
"chrome",
"explorer",
"UltimateServer"
]
}Kill a running process by name (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Request Body:
{
"processName": "notepad"
}Response:
{
"success": true,
"message": "Proccess stop request for 'notepad' has been queued and will be processed."
}List all available video filenames (requires user authentication).
Headers:
Authorization: Bearer <your-jwt-token>Response:
[
"example.mp4",
"another_video.avi"
]Upload a video from a URL (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>Request Body:
{
"url": "https://example.com/video.mp4"
}Response:
{
"success": true,
"message": "Video downloaded successfully."
}Stream a video file (requires admin authentication).
Headers:
Authorization: Bearer <your-jwt-token>
Range: bytes=0-1023Response:
Video file content with appropriate headers:
Content-Type: video/mp4
Content-Length: 10485760
Accept-Ranges: bytes
Content-Range: bytes 0-1023/10485760All API endpoints may return error responses with appropriate HTTP status codes:
{
"success": false,
"message": "Invalid input"
}When authentication is required but not provided or is invalid.
When authentication is valid, but the user does not have the required role (e.g., 'admin').
{
"success": false,
"message": "Resource not found"
}{
"success": false,
"message": "Server error"
}