Add Volumes

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETvolumesThe action specified carries out operation and returns success if the volumes has been added successfullyYes
addvolumePOSTaddvolumePass 1 to addvolumeYes
disk_namePOSTnameName of the VolumeYes
newseridPOSTseridServer ID of vps for which volume is to be createdYes
vpsidPOSTintvpsid for which volume is to be createdYes
sizePOSTfloatsize of volume in GBsYes
format_typePOSTtextFormat type of volume ext4 or xfsYes
attachPOST1/0To attach volume to vps pass 1 or 0 to create onlyYes
mnt_pointPOSTtextMountpoint to mount inside vps if you want to attach and mountNo
st_uuidPOSTintStorage uuid, If not passed Primary storage will be usedNo

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['addvolume'] = '1';
    $post['disk_name'] = 'second';
    $post['vpsid'] = '12115';
    $post['newserid'] = 4;
    $post['size'] = 1.5;
    $post['attach'] = 1;
    $post['format_type'] = 'ext4';
    $post['mnt_point'] = '/mnt/sec';
    $post['st_uuid'] = 'c3yq8jr9wbdskqz1';

    $output = $admin->add_volumes($post);
    print_r($output);


Output



Array
(
    ["done"] => Array
        (
            ["voladd_done"] => 1
        )

)



Was this page helpful?