Maintenance Mode

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

NameMethodValueDescriptionRequired
actGETmaintenanceThe action specified to perform operation and retrieve dataYes
offPOST1If Set the virtualizor server will be switched to maintenance modeYes
off_subjectPOSTtextThe Subject specified to switch to maintenance modeNo
off_messagePOSTtextThe message displayed during maintenance modeNo
maintenancePOST1If Set the mainenance mode will be enabledYes

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"
}
Was this helpful to you?