Use the Maintenance Mode API to turn on the maintenance mode on the server. After the server is in maintenance mode, no enduser will be able to login their panel. The API response will contain "done" as "1" after the maintenance mode is successfully turned on the server.
HTTP Request
https://hostname:4085/index.php?act=maintenance
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | maintenance | The action specified to perform operation and retrieve data | Yes |
off | POST | 1 | If Set the virtualizor server will be switched to maintenance mode | Yes |
off_subject | POST | text | The Subject specified to switch to maintenance mode | No |
off_message | POST | text | The message displayed during maintenance mode | No |
maintenance | POST | 1 | If Set the mainenance mode will be enabled | Yes |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['off'] = 1;
$post['off_subject'] = 'Testing maintenance with API';
$post['off_message'] = 'Maintenance test';
$post['maintenance'] = 1;
$output = $admin->maintenance($post);
print_r(json_encode($output));
?>
Output
{
"title": "Maintenance",
"done": "1",
"timenow": "1471392834",
"time_taken": "0.156"
}