Documentation Update

Dieser Commit ist enthalten in:
2025-06-22 12:47:59 +02:00
Ursprung 1b5b7d0381
Commit 889a7b4ebe
6 geänderte Dateien mit 620 neuen und 832 gelöschten Zeilen

Datei anzeigen

@@ -166,6 +166,68 @@ X-API-Key: your-api-key
}
```
### Session Management API Endpoints
#### POST /api/license/session/start
Start a new session for a license.
**Headers:**
```
X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
```
**Request:**
```json
{
"license_key": "XXXX-XXXX-XXXX-XXXX",
"machine_id": "DESKTOP-ABC123",
"hardware_hash": "unique-hardware-identifier",
"version": "1.0.0"
}
```
**Response:**
- 200 OK: Returns session_token and optional update info
- 409 Conflict: "Es ist nur eine Sitzung erlaubt..." (single session enforcement)
#### POST /api/license/session/heartbeat
Keep session alive with heartbeat.
**Headers:**
```
X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
```
**Request:**
```json
{
"session_token": "550e8400-e29b-41d4-a716-446655440000",
"license_key": "XXXX-XXXX-XXXX-XXXX"
}
```
**Response:** 200 OK with last_heartbeat timestamp
#### POST /api/license/session/end
End an active session.
**Headers:**
```
X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
```
**Request:**
```json
{
"session_token": "550e8400-e29b-41d4-a716-446655440000"
}
```
**Response:** 200 OK with session duration and end reason
### Version API Endpoints
#### POST /api/version/check
@@ -184,16 +246,7 @@ X-API-Key: your-api-key
}
```
**Response:**
```json
{
"update_available": true,
"latest_version": "1.1.0",
"download_url": "https://example.com/download/v1.1.0",
"release_notes": "Bug fixes and performance improvements",
"is_mandatory": false
}
```
**Response:** Update availability status with version info
#### GET /api/version/latest
Get latest version information.
@@ -203,16 +256,7 @@ Get latest version information.
X-API-Key: your-api-key
```
**Response:**
```json
{
"version": "1.1.0",
"release_date": "2025-06-15",
"download_url": "https://example.com/download/v1.1.0",
"release_notes": "Bug fixes and performance improvements",
"is_mandatory": false
}
```
**Response:** Latest version information
## Admin Panel API
@@ -240,109 +284,17 @@ Search customers for Select2 dropdown.
}
```
#### GET /api/customer/{customer_id}/licenses
Get licenses for a specific customer.
**Response:**
```json
{
"licenses": [
{
"id": 456,
"license_key": "XXXX-XXXX-XXXX-XXXX",
"type": "perpetual",
"status": "active",
"valid_until": "2026-01-01",
"max_activations": 5,
"current_activations": 3
}
]
}
```
#### GET /api/customer/{customer_id}/quick-stats
Get quick statistics for a customer.
**Response:**
```json
{
"total_licenses": 10,
"active_licenses": 8,
"total_activations": 25,
"total_users": 150
}
```
- `GET /api/customer/{id}/licenses` - List customer's licenses
- `GET /api/customer/{id}/quick-stats` - License and activation counts
### License Management API
#### POST /api/license/{license_id}/toggle
Toggle license active status.
**Response:**
```json
{
"success": true,
"is_active": true,
"message": "License activated successfully"
}
```
#### POST /api/licenses/bulk-activate
Activate multiple licenses.
**Request:**
```json
{
"license_ids": [1, 2, 3]
}
```
**Response:**
```json
{
"success": true,
"count": 3,
"message": "3 licenses activated successfully"
}
```
#### POST /api/licenses/bulk-deactivate
Deactivate multiple licenses.
**Request:**
```json
{
"license_ids": [1, 2, 3]
}
```
**Response:**
```json
{
"success": true,
"count": 3,
"message": "3 licenses deactivated successfully"
}
```
#### POST /api/licenses/bulk-delete
Delete multiple licenses.
**Request:**
```json
{
"license_ids": [1, 2, 3]
}
```
**Response:**
```json
{
"success": true,
"deleted": 3,
"message": "3 licenses deleted successfully"
}
```
- `POST /api/license/{id}/toggle` - Toggle active status
- `POST /api/licenses/bulk-activate` - Activate multiple (license_ids array)
- `POST /api/licenses/bulk-deactivate` - Deactivate multiple
- `POST /api/licenses/bulk-delete` - Delete multiple
- `POST /api/license/{id}/quick-edit` - Update validity/limits
- `GET /api/license/{id}/devices` - List registered devices
#### POST /api/license/{license_id}/quick-edit
Quick edit license properties.
@@ -547,7 +499,181 @@ Global search across all entities.
}
```
### Session Management API
### Lead Management API
#### GET /leads/api/institutions
Get all institutions with pagination.
**Query Parameters:**
- `page`: Page number (default: 1)
- `per_page`: Items per page (default: 20)
- `search`: Search query
**Response:**
```json
{
"institutions": [
{
"id": 1,
"name": "Tech University",
"contact_count": 5,
"created_at": "2025-06-19T10:00:00Z"
}
],
"total": 100,
"page": 1,
"per_page": 20
}
```
#### POST /leads/api/institutions
Create a new institution.
**Request:**
```json
{
"name": "New University"
}
```
**Response:**
```json
{
"id": 101,
"name": "New University",
"created_at": "2025-06-19T15:00:00Z"
}
```
#### GET /leads/api/contacts/{contact_id}
Get contact details.
**Response:**
```json
{
"id": 1,
"first_name": "John",
"last_name": "Doe",
"position": "IT Manager",
"institution_id": 1,
"details": [
{
"id": 1,
"type": "email",
"value": "john.doe@example.com",
"label": "Work"
},
{
"id": 2,
"type": "phone",
"value": "+49 123 456789",
"label": "Mobile"
}
],
"notes": [
{
"id": 1,
"content": "Initial contact",
"version": 1,
"created_at": "2025-06-19T10:00:00Z",
"created_by": "admin"
}
]
}
```
#### POST /leads/api/contacts/{contact_id}/details
Add contact detail (phone/email).
**Request:**
```json
{
"type": "email",
"value": "secondary@example.com",
"label": "Secondary"
}
```
**Response:**
```json
{
"id": 3,
"type": "email",
"value": "secondary@example.com",
"label": "Secondary"
}
```
### Resource Management API
#### GET /api/resources/availability
Get resource availability for license allocation.
**Response:**
```json
{
"domains": {
"available": 150,
"total": 200,
"status": "ok"
},
"ipv4": {
"available": 45,
"total": 100,
"status": "low"
},
"phone_numbers": {
"available": 5,
"total": 50,
"status": "critical"
}
}
```
#### POST /api/resources/allocate
Allocate resources to a license.
**Request:**
```json
{
"license_id": 123,
"resource_type": "domain",
"resource_ids": [45, 46, 47]
}
```
**Response:**
```json
{
"success": true,
"allocated": 3,
"message": "3 resources allocated successfully"
}
```
### Monitoring API
#### GET /api/monitoring/dashboard
Get monitoring dashboard data.
**Response:**
```json
{
"metrics": {
"total_licenses": 1500,
"active_licenses": 1200,
"total_customers": 250,
"active_sessions": 890
},
"alerts": [
{
"level": "warning",
"message": "High CPU usage on license server",
"timestamp": "2025-06-19T14:00:00Z"
}
]
}
```
#### GET /api/sessions/active-count
Get count of active sessions.
@@ -654,127 +780,37 @@ Get lead statistics.
- `500 Internal Server Error`: Server error
## Rate Limiting
- Public API: 100 requests per minute per IP
- Admin API: 1000 requests per minute per token
- Heartbeat endpoint: 1 request per minute per activation
- API endpoints: 100 requests/minute
- Login attempts: 5 per minute
- Configurable via Admin Panel
## Error Response Format
All errors return JSON with `error`, `code`, and `status` fields.
```json
{
"error": {
"code": "INVALID_LICENSE",
"message": "The provided license key is invalid",
"details": {
"field": "license_key",
"reason": "format_invalid"
}
}
}
```
## Client Integration
## Client Integration Examples
### Python
```python
import requests
import json
class LicenseClient:
def __init__(self, base_url):
self.base_url = base_url
def activate(self, license_key, hardware_id):
response = requests.post(
f"{self.base_url}/api/v1/activate",
json={
"license_key": license_key,
"hardware_id": hardware_id,
"machine_name": socket.gethostname(),
"app_version": "1.0.0"
}
)
return response.json()
def validate(self, license_key, activation_id, hardware_id):
response = requests.post(
f"{self.base_url}/api/v1/validate",
json={
"license_key": license_key,
"activation_id": activation_id,
"hardware_id": hardware_id,
"app_version": "1.0.0"
}
)
return response.json()
```
### C# Example
```csharp
public class LicenseClient
{
private readonly HttpClient _httpClient;
private readonly string _baseUrl;
public LicenseClient(string baseUrl)
{
_baseUrl = baseUrl;
_httpClient = new HttpClient();
}
public async Task<ActivationResponse> ActivateAsync(
string licenseKey,
HardwareInfo hardwareId)
{
var request = new
{
license_key = licenseKey,
hardware_id = hardwareId,
machine_name = Environment.MachineName,
app_version = "1.0.0"
};
var response = await _httpClient.PostAsJsonAsync(
$"{_baseUrl}/api/v1/activate",
request
);
return await response.Content.ReadFromJsonAsync<ActivationResponse>();
}
}
```
## Webhooks
### Configuration
Configure webhooks in the admin panel to receive notifications for:
- License activation
- License expiration
- Suspicious activity
- Usage threshold alerts
### Webhook Payload
```json
{
"event": "license.activated",
"timestamp": "2025-06-19T10:30:00Z",
"data": {
"license_id": 123,
"activation_id": "act_456",
"customer_id": 789
}
}
Example request with required headers:
```bash
curl -X POST http://localhost/api/license/activate \
-H "X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"license_key": "XXXX-XXXX-XXXX-XXXX",
"hardware_hash": "unique-hardware-id",
"machine_name": "DESKTOP-123",
"app_version": "1.0.0"
}'
```
## Testing
### Test Credentials
- License Key: `TEST-TEST-TEST-TEST`
- API Key: `test_api_key_123`
- JWT Secret: `test_jwt_secret`
- Admin Users:
- Username: `rac00n` / Password: `1248163264`
- Username: `w@rh@mm3r` / Password: `Warhammer123!`
- API Key: Generated in Admin Panel under "Lizenzserver Administration"
### Test Endpoints
- Development: `http://localhost:8080`
- Staging: `https://staging-api.example.com`
- Production: `https://api.example.com`
- Admin Panel: `http://localhost:80`
- License Server API: `http://localhost:80/api`
- Monitoring: See OPERATIONS_GUIDE.md