Server API Administrators
š ļø MidnightStreamer Pro API ā Administrators Management
MidnightStreamer Pro allows full API-based management of panel administrators. You can programmatically create, update, or list admin accounts using secure HTTP POST requests.
ā API Access Prerequisite
Before using the Admin API:
- Go to General Settings ā API Settings
- Whitelist your server IP address
- Generate or copy your API Key
You can pass the api_key
via POST or by appending it as the 4th segment in the URL.
ā Add New Administrator
Endpoint:
http://your-domain:8000/api/administrators/new
Required Parameters:
username
password
email
group_id
Optional:
reseller_id
Example PHP Code:
$panel_url = 'http://your-domain:8000/';
$api_key = 'your_api_key';
$username = 'test_username';
$password = 'test_password';
$email = '[email protected]';
$group_id = 1;
$reseller_id = 0;
$post_data = array(
'api_key' => $api_key,
'data' => array(
'username' => $username,
'password' => $password,
'email' => $email,
'group_id' => $group_id,
'reseller_id' => $reseller_id
)
);
$opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($post_data)
));
$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api/administrators/new", false, $context), true);
āļø Edit Administrator
Endpoint:
http://your-domain:8000/api/administrators/update
Required:
id
orusername
Example PHP Code:
$panel_url = 'http://your-domain:8000/';
$api_key = 'your_api_key';
$id = 1;
$email = '[email protected]';
$post_data = array(
'api_key' => $api_key,
'id' => $id,
'data' => array('email' => $email)
);
$opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($post_data)
));
$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api/administrators/update", false, $context), true);
š List All Administrators
Endpoint:
http://your-domain:8000/api/administrators/list
No parameters required.
Example PHP Code:
$panel_url = 'http://your-domain:8000/';
$api_key = 'your_api_key';
$post_data = array('api_key' => $api_key);
$opts = array('http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($post_data)
));
$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api/administrators/list", false, $context), true);