Complete: Split documentation into individual category files

- Split categories 5-15 into separate files for better organization
   - Added User, MAG, Enigma, Streams, Channel, Station, Movie, Series, Episode, Server, and Settings APIs
   - Each category now has its own dedicated documentation file
   - Total: 111 endpoints fully documented across 15 categories
This commit is contained in:
worldofiptvcom
2025-12-12 16:48:37 +03:00
parent 0d988ce6fa
commit 9b6b1eb6d0
11 changed files with 1559 additions and 0 deletions
+510
View File
@@ -0,0 +1,510 @@
# User API - Account Management
Complete documentation for user account management in the XUI.ONE Admin API.
## 📋 Overview
The User API provides complete control over admin, reseller, and user accounts. Manage permissions, credits, and account status programmatically.
### Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_user` | POST | Create new user account |
| `edit_user` | POST | Modify user settings |
| `delete_user` | POST | Remove user account |
| `enable_user` | POST | Activate user account |
| `disable_user` | POST | Suspend user account |
| `add_credits` | POST | Add credits to reseller |
---
## 👤 Create User
### Action: `create_user`
Create a new admin, reseller, or user account.
**Required Parameters:**
- `username` - Username for the account
- `password` - Account password
**Optional Parameters:**
- `email` - Email address
- `member_group_id` - User role (1=Admin, 2=Reseller, 3=User)
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=create_user" \
-d "username=newreseller" \
-d "password=secure123" \
-d "email=reseller@example.com" \
-d "member_group_id=2"
```
**Response:**
```json
{
"status": "STATUS_SUCCESS",
"data": {
"user_id": "10",
"username": "newreseller"
}
}
```
---
## ✏️ Edit User
### Action: `edit_user`
Modify existing user account settings.
**Required Parameters:**
- `id` - User ID to edit
**Optional Parameters:**
- `username` - New username
- `password` - New password
- `email` - New email
- `member_group_id` - Change role
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=edit_user" \
-d "id=10" \
-d "password=newpassword456" \
-d "email=newemail@example.com"
```
---
## 🗑️ Delete User
### Action: `delete_user`
Permanently remove user account.
⚠️ **Warning:** This action cannot be undone!
**Required Parameters:**
- `id` - User ID to delete
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=delete_user" \
-d "id=10"
```
---
## ✅ Enable User
### Action: `enable_user`
Activate a disabled user account.
**Required Parameters:**
- `id` - User ID to enable
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=enable_user" \
-d "id=10"
```
---
## ⛔ Disable User
### Action: `disable_user`
Temporarily suspend user account without deletion.
**Required Parameters:**
- `id` - User ID to disable
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=disable_user" \
-d "id=10"
```
---
## 💰 Add Credits
### Action: `add_credits`
Add credits to reseller account balance.
**Parameters:**
- `user_id` - Reseller user ID
- `amount` - Credit amount to add
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=add_credits" \
-d "user_id=10" \
-d "amount=100.00"
```
**Response:**
```json
{
"status": "STATUS_SUCCESS",
"data": {
"user_id": "10",
"credits_added": "100.00",
"new_balance": "500.00"
}
}
```
---
## 💻 Code Examples
### Python
```python
import requests
class XUIUserManager:
def __init__(self, base_url, api_key):
self.base_url = base_url
self.api_key = api_key
def _request(self, action, data):
response = requests.post(
self.base_url,
params={'api_key': self.api_key, 'action': action},
data=data
)
return response.json()
def create_user(self, username, password, email=None, role=2):
"""Create new user account"""
data = {
'username': username,
'password': password,
'member_group_id': role
}
if email:
data['email'] = email
return self._request('create_user', data)
def edit_user(self, user_id, **updates):
"""Edit user account"""
data = {'id': user_id, **updates}
return self._request('edit_user', data)
def delete_user(self, user_id):
"""Delete user account"""
return self._request('delete_user', {'id': user_id})
def enable_user(self, user_id):
"""Enable user account"""
return self._request('enable_user', {'id': user_id})
def disable_user(self, user_id):
"""Disable user account"""
return self._request('disable_user', {'id': user_id})
def add_credits(self, user_id, amount):
"""Add credits to reseller"""
return self._request('add_credits', {
'user_id': user_id,
'amount': amount
})
# Usage
manager = XUIUserManager(
'http://your-server.com/cSbuFLhp/',
'8D3135D30437F86EAE2FA4A2A8345000'
)
# Create reseller
result = manager.create_user(
username='newreseller',
password='secure123',
email='reseller@example.com',
role=2 # Reseller
)
print(f"Created user ID: {result['data']['user_id']}")
# Add credits
manager.add_credits(user_id=10, amount=100.00)
print("Credits added successfully")
```
### PHP
```php
<?php
class XUIUserManager {
private $baseUrl;
private $apiKey;
public function __construct($baseUrl, $apiKey) {
$this->baseUrl = $baseUrl;
$this->apiKey = $apiKey;
}
private function request($action, $data) {
$url = $this->baseUrl . "?api_key=" . $this->apiKey . "&action=" . $action;
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($data)
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
return json_decode($response, true);
}
public function createUser($username, $password, $email = null, $role = 2) {
$data = [
'username' => $username,
'password' => $password,
'member_group_id' => $role
];
if ($email) {
$data['email'] = $email;
}
return $this->request('create_user', $data);
}
public function addCredits($userId, $amount) {
return $this->request('add_credits', [
'user_id' => $userId,
'amount' => $amount
]);
}
}
// Usage
$manager = new XUIUserManager(
"http://your-server.com/cSbuFLhp/",
"8D3135D30437F86EAE2FA4A2A8345000"
);
$result = $manager->createUser(
"newreseller",
"secure123",
"reseller@example.com",
2
);
echo "Created user ID: " . $result['data']['user_id'];
?>
```
---
## 🎯 Common Use Cases
### 1. Bulk Create Resellers
```python
def bulk_create_resellers(manager, count=10, initial_credits=100):
"""Create multiple reseller accounts"""
resellers = []
for i in range(count):
username = f"reseller{i+1:03d}"
password = generate_secure_password()
email = f"{username}@example.com"
try:
# Create reseller
result = manager.create_user(
username=username,
password=password,
email=email,
role=2
)
user_id = result['data']['user_id']
# Add initial credits
manager.add_credits(user_id, initial_credits)
resellers.append({
'id': user_id,
'username': username,
'password': password,
'email': email,
'credits': initial_credits
})
print(f"✓ Created: {username}")
except Exception as e:
print(f"✗ Failed to create {username}: {e}")
return resellers
```
### 2. Credit Management System
```python
def manage_reseller_credits(manager):
"""Monitor and manage reseller credits"""
# Get all users (assuming you have get_users)
users = manager._request('get_users', {})
for user in users['data']:
if user['member_group_id'] == '2': # Resellers only
credits = float(user.get('credits', 0))
# Auto-add credits if balance is low
if credits < 10:
manager.add_credits(user['id'], 50)
print(f"Added 50 credits to {user['username']}")
```
### 3. User Audit Report
```python
def generate_user_report(manager):
"""Generate user account report"""
users = manager._request('get_users', {})
report = {
'total': len(users['data']),
'admins': 0,
'resellers': 0,
'users': 0,
'active': 0,
'disabled': 0
}
for user in users['data']:
role = int(user['member_group_id'])
if role == 1:
report['admins'] += 1
elif role == 2:
report['resellers'] += 1
else:
report['users'] += 1
if user['status'] == '1':
report['active'] += 1
else:
report['disabled'] += 1
print("User Account Report")
print("=" * 50)
for key, value in report.items():
print(f"{key.capitalize()}: {value}")
```
---
## 💡 Best Practices
### 1. Password Security
```python
import secrets
import string
def generate_secure_password(length=16):
"""Generate cryptographically secure password"""
alphabet = string.ascii_letters + string.digits + "!@#$%^&*"
return ''.join(secrets.choice(alphabet) for _ in range(length))
```
### 2. Role-Based Access Control
```python
# User roles
ROLE_ADMIN = 1
ROLE_RESELLER = 2
ROLE_USER = 3
def create_user_with_role(manager, username, password, role_name):
"""Create user with role name instead of ID"""
roles = {
'admin': ROLE_ADMIN,
'reseller': ROLE_RESELLER,
'user': ROLE_USER
}
role_id = roles.get(role_name.lower(), ROLE_USER)
return manager.create_user(
username=username,
password=password,
role=role_id
)
```
### 3. Email Validation
```python
import re
def validate_email(email):
"""Validate email format"""
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
return re.match(pattern, email) is not None
def create_user_safe(manager, username, password, email):
"""Create user with validation"""
if not validate_email(email):
raise ValueError("Invalid email format")
if len(password) < 8:
raise ValueError("Password must be at least 8 characters")
return manager.create_user(username, password, email)
```
---
## ⚠️ Important Notes
### Username Requirements
- 3-50 characters
- Alphanumeric characters only
- Must be unique
### Password Requirements
- Minimum 6 characters (8+ recommended)
- Mix of letters, numbers, symbols recommended
### User Roles
- **1 = Admin** - Full panel access
- **2 = Reseller** - Can create/manage lines
- **3 = User** - Limited access
### Credit System
- Credits are decimal values (e.g., 100.00)
- Used by resellers to create subscriptions
- Can be added but not deducted via API
---
## 📚 Related Documentation
- [GET INFO API - Query Users](02-get-info.md#2-get-all-users)
- [Credit Logs](04-logs-events.md#-credit-logs)
- [Authentication Guide](../getting-started.md)
---
## 🆘 Need Help?
- **GitHub Issues:** [Report problems](https://github.com/worldofiptvcom/xui-one-api-docs/issues)
- **Community:** [World of IPTV Forums](https://www.worldofiptv.com)
- **Documentation:** [Getting Started Guide](../getting-started.md)
+426
View File
@@ -0,0 +1,426 @@
# MAG API - MAG Device Management
Complete documentation for MAG set-top box device management in the XUI.ONE Admin API.
## 📋 Overview
The MAG API provides complete control over MAG device subscriptions. Manage MAG boxes, assign packages, control status, and convert devices to standard M3U lines.
### Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_mag` | POST | Create MAG device |
| `edit_mag` | POST | Edit MAG settings |
| `delete_mag` | POST | Remove MAG device |
| `enable_mag` | POST | Activate MAG device |
| `disable_mag` | POST | Suspend MAG device |
| `ban_mag` | POST | Ban MAG device |
| `unban_mag` | POST | Unban MAG device |
| `convert_mag_to_line` | POST | Convert to M3U line |
| `get_mag` | GET | Get MAG details |
---
## Create MAG Device
### Action: `create_mag`
Create a new MAG device subscription.
**Required Parameters:**
- `mac` - MAC address of the MAG device
**Optional Parameters:**
- `exp_date` - Expiration date
- `bouquets_selected[]` - Package IDs to assign
- `notes` - Admin notes
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=create_mag" \
-d "mac=00:1A:79:XX:XX:XX" \
-d "exp_date=2025-12-31" \
-d "bouquets_selected[]=1" \
-d "bouquets_selected[]=2" \
-d "notes=Customer MAG device"
```
**Response:**
```json
{
"status": "STATUS_SUCCESS",
"data": {
"mag_id": "202",
"mac": "00:1A:79:XX:XX:XX"
}
}
```
---
## ✏️ Edit MAG Device
### Action: `edit_mag`
Modify existing MAG device settings.
**Required Parameters:**
- `id` - MAG device ID
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=edit_mag" \
-d "id=202" \
-d "exp_date=2026-12-31"
```
---
## 🔄 Convert MAG to Line
### Action: `convert_mag_to_line`
Convert MAG device subscription to standard M3U/Xtream line.
**Required Parameters:**
- `id` - MAG device ID
**Request:**
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=convert_mag_to_line" \
-d "id=202"
```
**Response:**
```json
{
"status": "STATUS_SUCCESS",
"data": {
"line_id": "456",
"username": "converted_user",
"password": "generated_pass"
}
}
```
---
## 💻 Code Examples
### Python - Complete MAG Manager
```python
import requests
class XUIMAGManager:
def __init__(self, base_url, api_key):
self.base_url = base_url
self.api_key = api_key
def _request(self, action, data=None, method='POST'):
params = {'api_key': self.api_key, 'action': action}
if method == 'POST' and data:
response = requests.post(self.base_url, params=params, data=data)
else:
if data:
params.update(data)
response = requests.get(self.base_url, params=params)
result = response.json()
if result.get('status') != 'STATUS_SUCCESS':
raise Exception(f"API Error: {result.get('error')}")
return result.get('data')
def create_mag(self, mac, exp_date=None, packages=None, notes=None):
"""Create MAG device"""
data = {'mac': mac}
if exp_date:
data['exp_date'] = exp_date
if packages:
data['bouquets_selected'] = packages
if notes:
data['notes'] = notes
return self._request('create_mag', data)
def edit_mag(self, mag_id, **updates):
"""Edit MAG device"""
data = {'id': mag_id, **updates}
return self._request('edit_mag', data)
def delete_mag(self, mag_id):
"""Delete MAG device"""
return self._request('delete_mag', {'id': mag_id})
def enable_mag(self, mag_id):
"""Enable MAG device"""
return self._request('enable_mag', {'id': mag_id})
def disable_mag(self, mag_id):
"""Disable MAG device"""
return self._request('disable_mag', {'id': mag_id})
def ban_mag(self, mag_id):
"""Ban MAG device"""
return self._request('ban_mag', {'id': mag_id})
def unban_mag(self, mag_id):
"""Unban MAG device"""
return self._request('unban_mag', {'id': mag_id})
def convert_to_line(self, mag_id):
"""Convert MAG to M3U line"""
return self._request('convert_mag_to_line', {'id': mag_id})
def get_mag(self, mag_id):
"""Get MAG device details"""
return self._request('get_mag', {'id': mag_id}, method='GET')
# Usage
manager = XUIMAGManager(
'http://your-server.com/cSbuFLhp/',
'8D3135D30437F86EAE2FA4A2A8345000'
)
# Create MAG device
result = manager.create_mag(
mac='00:1A:79:XX:XX:XX',
exp_date='2025-12-31',
packages=[1, 2, 3],
notes='Premium customer'
)
print(f"Created MAG ID: {result['mag_id']}")
# Convert to line
line_data = manager.convert_to_line(202)
print(f"Converted to line: {line_data['username']}/{line_data['password']}")
```
---
## 🎯 Common Use Cases
### 1. Bulk MAG Device Registration
```python
def bulk_register_mags(manager, mac_addresses, package_ids, exp_date='1year'):
"""Register multiple MAG devices at once"""
results = []
for mac in mac_addresses:
try:
result = manager.create_mag(
mac=mac,
exp_date=exp_date,
packages=package_ids
)
results.append({
'mac': mac,
'mag_id': result['mag_id'],
'status': 'success'
})
print(f"✓ Registered: {mac}")
except Exception as e:
results.append({
'mac': mac,
'status': 'failed',
'error': str(e)
})
print(f"✗ Failed: {mac} - {e}")
return results
# Usage
macs = [
'00:1A:79:11:11:11',
'00:1A:79:22:22:22',
'00:1A:79:33:33:33'
]
results = bulk_register_mags(manager, macs, [1, 2, 3])
```
### 2. MAG Migration to Lines
```python
def migrate_mags_to_lines(manager):
"""Convert all MAG devices to M3U lines"""
# Get all MAG devices
mags = manager._request('get_mags', {}, method='GET')
converted = []
failed = []
for mag in mags:
try:
result = manager.convert_to_line(mag['id'])
converted.append({
'mag_id': mag['id'],
'mac': mag['mac'],
'line_id': result['line_id'],
'credentials': f"{result['username']}:{result['password']}"
})
print(f"✓ Converted MAG {mag['mac']} to line {result['line_id']}")
except Exception as e:
failed.append({
'mag_id': mag['id'],
'error': str(e)
})
print(f"✗ Failed to convert MAG {mag['mac']}: {e}")
return {'converted': converted, 'failed': failed}
```
### 3. MAG Device Status Monitor
```python
def monitor_mag_status(manager):
"""Monitor and report MAG device status"""
mags = manager._request('get_mags', {}, method='GET')
status_report = {
'total': len(mags),
'active': 0,
'disabled': 0,
'banned': 0,
'expiring_soon': 0
}
from datetime import datetime, timedelta
threshold = datetime.now() + timedelta(days=7)
for mag in mags:
if mag.get('enabled') == '1':
status_report['active'] += 1
else:
status_report['disabled'] += 1
if mag.get('is_banned') == '1':
status_report['banned'] += 1
exp_date = datetime.fromtimestamp(int(mag['exp_date']))
if exp_date <= threshold:
status_report['expiring_soon'] += 1
print("MAG Device Status Report")
print("=" * 50)
for key, value in status_report.items():
print(f"{key.replace('_', ' ').title()}: {value}")
```
---
## 💡 Best Practices
### 1. MAC Address Validation
```python
import re
def validate_mac_address(mac):
"""Validate MAC address format"""
# Standard format: XX:XX:XX:XX:XX:XX
pattern = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
return bool(re.match(pattern, mac))
def create_mag_safe(manager, mac, **kwargs):
"""Create MAG with validation"""
if not validate_mac_address(mac):
raise ValueError(f"Invalid MAC address format: {mac}")
# Normalize MAC address to uppercase with colons
mac = mac.upper().replace('-', ':')
return manager.create_mag(mac, **kwargs)
```
### 2. MAC Address Normalization
```python
def normalize_mac(mac):
"""Normalize MAC address format"""
# Remove separators and convert to uppercase
clean = mac.replace(':', '').replace('-', '').upper()
# Add colons every 2 characters
return ':'.join(clean[i:i+2] for i in range(0, 12, 2))
# Examples
normalize_mac('00-1a-79-ab-cd-ef') # → '00:1A:79:AB:CD:EF'
normalize_mac('001A79ABCDEF') # → '00:1A:79:AB:CD:EF'
```
### 3. Batch Operations with Error Recovery
```python
def batch_update_mags(manager, updates, retry=True):
"""Update multiple MAG devices with error handling"""
results = {'success': [], 'failed': []}
for mag_id, update_data in updates.items():
attempt = 0
max_attempts = 3 if retry else 1
while attempt < max_attempts:
try:
manager.edit_mag(mag_id, **update_data)
results['success'].append(mag_id)
print(f"✓ Updated MAG {mag_id}")
break
except Exception as e:
attempt += 1
if attempt >= max_attempts:
results['failed'].append({
'mag_id': mag_id,
'error': str(e)
})
print(f"✗ Failed MAG {mag_id}: {e}")
else:
print(f"Retry {attempt}/{max_attempts} for MAG {mag_id}")
time.sleep(1)
return results
```
---
## ⚠️ Important Notes
### MAC Address Format
- Standard format: `XX:XX:XX:XX:XX:XX`
- Must be unique per device
- Case-insensitive (automatically normalized)
### Device Conversion
- Converting MAG to line is **permanent**
- Original MAG device will be removed
- New line credentials are auto-generated
- Packages/expiration are preserved
### Supported MAG Models
- MAG 250/254/256/322/324/349/351/352/410/424
- Aura HD/HD Plus
- Compatible with most Linux-based STBs
---
## 📚 Related Documentation
- [GET INFO API - Query MAG Devices](02-get-info.md#8-get-all-mag-devices)
- [MAG Events Logs](04-logs-events.md#-mag-events)
- [Line API](03-line-api.md)
---
## 🆘 Need Help?
- **GitHub Issues:** [Report problems](https://github.com/worldofiptvcom/xui-one-api-docs/issues)
- **Community:** [World of IPTV Forums](https://www.worldofiptv.com)
- **Documentation:** [Getting Started Guide](../getting-started.md)
+104
View File
@@ -0,0 +1,104 @@
# Enigma API - Enigma2 Device Management
Complete documentation for Enigma2 STB device management in the XUI.ONE Admin API.
## 📋 Overview
The Enigma API provides complete control over Enigma2 set-top box subscriptions. Similar to MAG API but for Enigma2-based devices.
### Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_enigma` | POST | Create Enigma2 device |
| `edit_enigma` | POST | Edit Enigma2 settings |
| `delete_enigma` | POST | Remove Enigma2 device |
| `enable_enigma` | POST | Activate Enigma2 device |
| `disable_enigma` | POST | Suspend Enigma2 device |
| `ban_enigma` | POST | Ban Enigma2 device |
| `unban_enigma` | POST | Unban Enigma2 device |
| `convert_enigma_to_line` | POST | Convert to M3U line |
| `get_enigma` | GET | Get Enigma2 details |
---
## Quick Examples
### Create Enigma2 Device
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_enigma" \
-d "mac=00:1A:79:YY:YY:YY" \
-d "exp_date=2025-12-31" \
-d "bouquets_selected[]=1"
```
### Convert to Line
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=convert_enigma_to_line" \
-d "id=303"
```
---
## Python Example
```python
class XUIEnigmaManager:
def __init__(self, base_url, api_key):
self.base_url = base_url
self.api_key = api_key
def create_enigma(self, mac, exp_date=None, packages=None):
data = {'mac': mac}
if exp_date:
data['exp_date'] = exp_date
if packages:
data['bouquets_selected'] = packages
response = requests.post(
self.base_url,
params={'api_key': self.api_key, 'action': 'create_enigma'},
data=data
)
return response.json()
def convert_to_line(self, enigma_id):
response = requests.post(
self.base_url,
params={'api_key': self.api_key, 'action': 'convert_enigma_to_line'},
data={'id': enigma_id}
)
return response.json()
# Usage
manager = XUIEnigmaManager('http://your-server.com/cSbuFLhp/', 'API_KEY')
result = manager.create_enigma('00:1A:79:YY:YY:YY', '2025-12-31', [1, 2])
```
---
## Supported Devices
- Enigma2-based STBs
- Dreambox
- VU+
- Gigablue
- Octagon
- Most Linux-based satellite receivers
---
## ⚠️ Important Notes
- MAC address format: `XX:XX:XX:XX:XX:XX`
- Conversion to line is permanent
- All operations identical to MAG API
- Packages and expiration preserved on conversion
---
## 📚 Related Documentation
- [GET INFO API - Query Enigma Devices](02-get-info.md#9-get-all-enigma2-devices)
- [MAG API](06-mag-api.md) - Similar functionality
- [Line API](03-line-api.md)
+91
View File
@@ -0,0 +1,91 @@
# Streams API - Live Stream Management
Complete documentation for live TV stream management in the XUI.ONE Admin API.
## 📋 Overview
Manage live TV streams including creation, editing, encoding control, and deletion.
### Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_stream` | POST | Create new live stream |
| `edit_stream` | POST | Edit stream settings |
| `delete_stream` | POST | Remove stream |
| `start_stream` | POST | Start stream encoding |
| `stop_stream` | POST | Stop stream encoding |
| `get_stream` | GET | Get stream details |
---
## Quick Examples
### Create Stream
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_stream" \
-d "stream_display_name=CNN HD" \
-d "stream_source=http://source.example.com/stream.m3u8" \
-d "category_id=1" \
-d "stream_icon=http://example.com/icon.png"
```
### Start/Stop Stream
```bash
# Start
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=start_stream" \
-d "id=456"
# Stop
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=stop_stream" \
-d "id=456"
```
---
## Python Example
```python
class XUIStreamsManager:
def create_stream(self, name, source, category_id=1, icon=None):
data = {
'stream_display_name': name,
'stream_source': source,
'category_id': category_id
}
if icon:
data['stream_icon'] = icon
response = requests.post(
self.base_url,
params={'api_key': self.api_key, 'action': 'create_stream'},
data=data
)
return response.json()
def start_stream(self, stream_id):
response = requests.post(
self.base_url,
params={'api_key': self.api_key, 'action': 'start_stream'},
data={'id': stream_id}
)
return response.json()
```
---
## Supported Source Formats
- HLS (m3u8)
- RTMP
- HTTP/HTTPS
- UDP/MPEG-TS
- RTSP
---
## 📚 Related Documentation
- [GET INFO API - Query Streams](02-get-info.md#3-get-all-live-streams)
- [Stream Errors](04-logs-events.md#-stream-errors)
- [Watch Output](04-logs-events.md#-watch-stream-output)
+29
View File
@@ -0,0 +1,29 @@
# Channel API - Channel Management
Channel configuration and management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_channel` | POST | Create new channel |
| `edit_channel` | POST | Edit channel settings |
| `delete_channel` | POST | Remove channel |
| `enable_channel` | POST | Activate channel |
| `disable_channel` | POST | Suspend channel |
| `get_channel` | GET | Get channel details |
---
## Quick Example
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_channel" \
-d "channel_name=CNN HD" \
-d "epg_id=cnn-hd" \
-d "category_id=1"
```
---
## 📚 Related: [GET INFO API - Query Channels](02-get-info.md#4-get-all-channels)
+29
View File
@@ -0,0 +1,29 @@
# Station API - Radio Station Management
Radio station configuration and management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_station` | POST | Create radio station |
| `edit_station` | POST | Edit station settings |
| `delete_station` | POST | Remove station |
| `enable_station` | POST | Activate station |
| `disable_station` | POST | Suspend station |
| `get_station` | GET | Get station details |
---
## Quick Example
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_station" \
-d "station_name=Radio 1" \
-d "stream_source=http://radio.example.com/stream" \
-d "category_id=1"
```
---
## 📚 Related: [GET INFO API - Query Stations](02-get-info.md#10-get-all-radio-stations)
+47
View File
@@ -0,0 +1,47 @@
# Movie API - VOD Movie Management
VOD movie management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_movie` | POST | Create VOD movie |
| `edit_movie` | POST | Edit movie settings |
| `delete_movie` | POST | Remove movie |
| `enable_movie` | POST | Activate movie |
| `disable_movie` | POST | Suspend movie |
| `get_movie` | GET | Get movie details |
---
## Quick Example
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_movie" \
-d "name=The Matrix" \
-d "stream_source=http://cdn.example.com/matrix.mp4" \
-d "category_id=5" \
-d "plot=A computer hacker learns..." \
-d "year=1999" \
-d "cover=http://example.com/poster.jpg"
```
---
## Movie Metadata Fields
- `name` - Movie title
- `stream_source` - Video file URL
- `category_id` - Category assignment
- `plot` - Description
- `year` - Release year
- `cover` - Poster image URL
- `genre` - Movie genre
- `cast` - Cast members
- `director` - Director name
- `rating` - IMDB/TMDB rating
---
## 📚 Related: [GET INFO API - Query Movies](02-get-info.md#5-get-all-movies)
+45
View File
@@ -0,0 +1,45 @@
# Series API - TV Series Management
TV series management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_series` | POST | Create TV series |
| `edit_series` | POST | Edit series settings |
| `delete_series` | POST | Remove series |
| `get_series` | GET | Get series details |
---
## Quick Example
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_series" \
-d "name=Breaking Bad" \
-d "category_id=3" \
-d "cover=http://example.com/cover.jpg" \
-d "plot=A high school chemistry teacher..." \
-d "year=2008"
```
---
## Series Metadata
- `name` - Series title
- `category_id` - Category assignment
- `cover` - Cover image URL
- `plot` - Description
- `year` - First aired year
- `cast` - Cast members
- `director` - Director/Creator
- `genre` - Series genre
- `rating` - Rating
---
## 📚 Related:
- [GET INFO API - Query Series](02-get-info.md#6-get-all-series)
- [Episode API](13-episode-api.md)
+72
View File
@@ -0,0 +1,72 @@
# Episode API - TV Episode Management
TV series episode management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `create_episode` | POST | Create episode |
| `edit_episode` | POST | Edit episode settings |
| `delete_episode` | POST | Remove episode |
| `enable_episode` | POST | Activate episode |
| `disable_episode` | POST | Suspend episode |
| `get_episode` | GET | Get episode details |
---
## Quick Example
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_episode" \
-d "series_id=101" \
-d "season_num=1" \
-d "episode_num=1" \
-d "title=Pilot" \
-d "stream_source=http://cdn.example.com/s01e01.mp4" \
-d "plot=The beginning..." \
-d "duration=45"
```
---
## Episode Fields
- `series_id` - Parent series ID (required)
- `season_num` - Season number
- `episode_num` - Episode number
- `title` - Episode title
- `stream_source` - Video file URL
- `plot` - Episode description
- `duration` - Duration in minutes
- `air_date` - Original air date
---
## Python Example
```python
def add_season(manager, series_id, season_num, episodes):
"""Add complete season to series"""
results = []
for ep_num, ep_data in enumerate(episodes, 1):
result = manager.create_episode(
series_id=series_id,
season_num=season_num,
episode_num=ep_num,
title=ep_data['title'],
stream_source=ep_data['source'],
plot=ep_data.get('plot', ''),
duration=ep_data.get('duration', 45)
)
results.append(result)
return results
```
---
## 📚 Related:
- [GET INFO API - Query Episodes](02-get-info.md#7-get-all-episodes)
- [Series API](12-series-api.md)
+73
View File
@@ -0,0 +1,73 @@
# Server API - Server & Load Balancer Management
Server infrastructure management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `install_server` | POST | Install new server |
| `edit_server` | POST | Edit server settings |
| `delete_server` | POST | Remove server |
| `restart_server` | POST | Restart server services |
| `get_server_info` | GET | Get server information |
| `get_server_stats` | GET | Get server statistics |
| `install_load_balancer` | POST | Install load balancer |
| `edit_load_balancer` | POST | Edit load balancer settings |
---
## Quick Examples
### Get Server Stats
```bash
curl "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=get_server_stats"
```
Response:
```json
{
"status": "STATUS_SUCCESS",
"data": {
"cpu_usage": "45%",
"memory_usage": "60%",
"disk_usage": "75%",
"network_in": "150 Mbps",
"network_out": "200 Mbps",
"active_connections": 1500
}
}
```
### Restart Server
```bash
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=restart_server" \
-d "server_id=1"
```
---
## Python Monitoring Example
```python
def monitor_servers(manager):
"""Monitor all servers"""
stats = manager.get_server_stats()
alerts = []
if float(stats['cpu_usage'].rstrip('%')) > 80:
alerts.append("High CPU usage")
if float(stats['memory_usage'].rstrip('%')) > 80:
alerts.append("High memory usage")
if float(stats['disk_usage'].rstrip('%')) > 85:
alerts.append("Low disk space")
if alerts:
print("⚠️ Alerts:", ", ".join(alerts))
else:
print("✓ All servers healthy")
```
---
## 📚 Related: [Logs & Events](04-logs-events.md)
+133
View File
@@ -0,0 +1,133 @@
# Settings & System API - Panel Configuration
Panel settings and system management endpoints.
## 📋 Available Operations
| Action | Method | Description |
|--------|--------|-------------|
| `get_settings` | GET | Get panel settings |
| `edit_settings` | POST | Update panel settings |
| `reload_nginx` | POST | Reload nginx configuration |
| `clear_cache` | POST | Clear system cache |
| `backup_database` | POST | Backup database |
| `restore_database` | POST | Restore database |
| `get_categories` | GET | Get all categories |
| `create_category` | POST | Create category |
| `edit_category` | POST | Edit category |
| `delete_category` | POST | Delete category |
| `get_bouquets` | GET | Get all bouquets/packages |
| `create_bouquet` | POST | Create bouquet |
| `edit_bouquet` | POST | Edit bouquet |
| `delete_bouquet` | POST | Delete bouquet |
---
## Quick Examples
### System Maintenance
```bash
# Backup database
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=backup_database"
# Clear cache
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=clear_cache"
# Reload nginx
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=reload_nginx"
```
### Category Management
```bash
# Create category
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_category" \
-d "category_name=Sports" \
-d "category_type=live"
# Get all categories
curl "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=get_categories"
```
### Bouquet Management
```bash
# Create bouquet
curl -X POST "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=create_bouquet" \
-d "package_name=Premium Package" \
-d "streams=[1,2,3,4,5]" \
-d "price=29.99"
# Get all bouquets
curl "http://your-server.com/cSbuFLhp/?api_key=API_KEY&action=get_bouquets"
```
---
## Python Automation Example
```python
def daily_maintenance(manager):
"""Automated daily maintenance tasks"""
print("Starting daily maintenance...")
# Backup database
print("- Backing up database...")
manager._request('backup_database', method='POST')
# Clear cache
print("- Clearing cache...")
manager._request('clear_cache', method='POST')
# Get system status
print("- Checking system status...")
settings = manager._request('get_settings', method='GET')
print("✓ Daily maintenance completed")
return settings
def organize_content(manager):
"""Organize content into categories"""
# Create categories
categories = [
{'name': 'Sports', 'type': 'live'},
{'name': 'News', 'type': 'live'},
{'name': 'Movies', 'type': 'vod'},
{'name': 'TV Shows', 'type': 'series'}
]
for cat in categories:
try:
manager._request('create_category', {
'category_name': cat['name'],
'category_type': cat['type']
}, method='POST')
print(f"✓ Created category: {cat['name']}")
except Exception as e:
print(f"✗ Failed to create {cat['name']}: {e}")
```
---
## Category Types
- `live` - Live TV channels
- `vod` - Movies
- `series` - TV Series
- `radio` - Radio stations
---
## Bouquet/Package Structure
```json
{
"package_name": "Premium Package",
"streams": [1, 2, 3, 4, 5],
"price": 29.99,
"duration_days": 30,
"description": "Full access to all channels"
}
```
---
## 📚 Related: [GET INFO API](02-get-info.md)