Get Virtualizor

Add Server Groups

Server Groups are possible only in case of a Cluster setup of Virtualizor Servers. The Add Server Groups API allows you to create server groups as per the locations of the servers. The API response will contain "done" as "1" after successful creation of the server groups.

These Server groups allow you to differentiate between multiple servers which can be very useful during the billing process. For example, Lets say you have 10 Servers in the USA and 5 in Europe. You can create two groups which can be used in the Billing Module for creating seperate orders.

For more information, please refer this Server Groups guide.

HTTP Request

https://hostname:4085/index.php?act=addsg

Parameters

NameMethodValueDescriptionRequired
actGETaddsgThe action specified to perform operation and return "done" as "1" after the server group has been added successfullyYes
addsgPOST1/0Flag to add Server GroupYes
sg_namePOSTtextServer Group NameYes
sg_reseller_namePOSTtextThe name that will be shown to resellersNo
sg_descPOSTtextDescription of the GroupNo
sg_selectPOST1/0Server Selection (0 for Least Utilized and 1 for First Available)No

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['addsg'] = 1;
    $post['sg_name'] = 'test_sg';
    $post['sg_reseller_name'] = 'US';
    $post['sg_desc'] = 'This is just test';
    $post['sg_select'] = 0;

    $output = $admin->addsg($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Add Server Group / Regions",
    "done": 4, //Server group ID
    "timenow": 1535486540,
    "time_taken": "0.214"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list