Get Virtualizor

List volumes

Use List Volume API to list all volumes on the server,

This function is for cloud user

HTTP Request

https://hostname:4083/index.php?act=volume

Parameters

ParametersTypeValueDescription
actGETvolumeThe action will create volume for a particular user and vps.
vps_selPOSTvpsidVpsid for which volume is to be created.
vol_size
POSTfloatSize of volume to be created in GB's.
formatPOSTtextFormat for volume ext4 or xfs.
attach_volPOSTintPass 1 to create and attach it to vps or 0 to just create it.
volnamePOSTtextName of the volume.

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'host_ip';

    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);

    $post = array();
    $volume_list = $v->listvolumes();
    print_r($volume_list);

Curl

curl -k -L "https://hostname:4083/index.php?act=volume
&api=json&apikey=your_api_key
&apipass=your_api_pass"

Output

Array
(
    [247] => Array
        (
            [did] => 247
            [disk_uuid] => d4sl17zln359niz8
            [st_uuid] => rjpzdi7exu0njjeh
            [vps_uuid] => tjkgme2cjn9tgzet
            [path] => /dev/vgs/vsv1003attach-d4sl17zln359niz8-tjkgme2cjn9tgzet
            [primary] => 0
            [size] => 1.000
            [size_unit] =>
            [type] => block
            [format] => raw
            [num] => 1
            [rescue] => 0
            [extra] =>
            [bus_driver] =>
            [bus_driver_num] => 0
            [user_uid] => 2
            [disk_name] => sec
            [mnt_point] => /mnt
            [stid] => 1
            [vpsid] => 143
            [vps_name] => v1003
            [serid] => 1
            [sgid] => 0
            [user_email] => testvirt.com
        )

)
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list