Delete Server Group

Use the Delete Server Group API to delete the server group information using the server group ID. The API response will contain “done” as the deleted servergroup details.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETservergroupsThe action will list the server group after particular server group is deletedYes
deletePOSTIntThe server group ID that needs to be deleted, for deleting multiple group pass the IDs as comma separated valuesYes

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['delete'] = 1;
    $post['delete'] = '1,2'; // For Deleting multiple servergroups

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Server Groups / Regions",
    "done": {
        "1": {
            "sgid": "1",
            "sg_name": "test@te",
            "sg_desc": ""
        }
    },
    "servergroups": [
        {
            "sgid": 0,
            "sg_name": "Default",
            "sg_reseller_name": "Default",
            "sg_desc": "Default Group",
            "sg_select": 0
        },
        {
            "sgid": "1",
            "sg_name": "test@te",
            "sg_reseller_name": "test",
            "sg_desc": "",
            "sg_select": "0"
        },
        {
            "sgid": "2",
            "sg_name": "test_sg",
            "sg_reseller_name": "US",
            "sg_desc": "This is just test",
            "sg_select": "0"
        }
    ],
    "timenow": 1535488141,
    "time_taken": "0.218"
}
Was this helpful to you?