Get Virtualizor

Edit Server group

Use the Edit Server group API to update the server groups information. The API response will contain "done" as "1" after successful update 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=editsg&sgid=SGID

Parameters

NameMethodValueDescriptionRequired
actGETeditsgThe action will perform the operation and will "done" as "1" on successful update of the servergroupYes
sgidGETIntThe server group ID which needs to be editedYes
sg_namePOSTtextServer Group NameYes
sg_reseller_namePOSTtextThe name that will be shown to resellers (Optional)No
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['editsg'] = 1;
    $post['sgid'] = 1;
    $post['sg_name'] = 'Test Group';
    $post['sg_reseller_name'] = 'Test Reseller Name';

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Edit Server Group / Region",
    "done": 1,
    "servergroup": {
        "sgid": "1",
        "sg_name": "Test Group",
        "sg_reseller_name": "Test Reseller Name",
        "sg_desc": "",
        "sg_select": "0"
    },
    "timenow": 1535487536,
    "time_taken": "0.220"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list