Get Virtualizor

List volumes

Virtualizor allows you to create and attach multiple volumes per vps. Use the List Volumes API to list information about the volumes on the server. The API response contains all the details of the volumes which are listed according to their IDs. To filter or limit the size of the list, you can specify one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=volumes&name=volumename&path=volume_path&user_email=user_email&search=Search

Parameters

NameMethodValueDescriptionRequired
actGETvolumesThe action performed to perform operation and retrieve list of volumesYes
pagePOSTIntIf not specified then first 50 records would be returnedNo
reslenPOSTIntNumber of records to be returned, default is 50No
nameGETtextSearch volume by volume nameNo
pathGETtextSearch volume by volume pathNo

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);

    $page = 1;
    $reslen = 50;
    $post = array();
    $post['name'] = '';
    $post['path']= '';
    $post['user_email'] = 'test.com';

    $output = $admin->list_volumes($post, $page, $reslen);

    print_r(json_encode($output));
?>

Output


(
   '7974' => 
(
     'did' => '7974',
     'disk_uuid' => 'dbecgzpqpynqjlw8',
     'st_uuid' => 'c3yq8jr9wbdskqz1',
     'vps_uuid' => 'f2zxowehwmkjjrpt',
     'path' => '/dev/vg1/vsv1025attach-dbecgzpqpynqjlw8-f2zxowehwmkjjrpt',
     'primary' => '0',
     'size' => '2.000',
     'size_unit' => '',
     'type' => 'block',
     'format' => 'raw',
     'num' => '1',
     'rescue' => '0',
     'extra' => NULL,
     'bus_driver' => '',
     'bus_driver_num' => '0',
     'user_uid' => '710',
     'disk_name' => 'disk_two2',
     'mnt_point' => '/root/mt',
     'stid' => '874',
     'vpsid' => '12146',
     'vps_name' => 'v1025',
     'serid' => '4',
     'user_email' => 'test.com',
  ),
)
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list