Get Virtualizor

Mediagroups

Media groups allow the admin to manage the ISOs / OS templates which are used for creating Virtual Private Servers. You can group multiple ISOs in a single media group and assign that media group to particular enduser, ensuring that the enduser has access to only those ISOs for creating Virtual Private Servers.Use the Mediagroups API to list all the mediagroups present on the server. The API response will contain a list of information about the media groups which are listed according to the media group IDs. To filter or limit the size of the list you can pass in one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=mediagroups&mgid=MGID&mg_name=MG_NAME&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETmediagroupsThe action specified to perform operation and retrieve dataYes
pageGETIntIf not specified, then only first 50 records are returnedNo
reslenGETIntNumber of records to be returned, default is 50No
mg_nameGETtextFilter the list using the media group nameNo
mgidGETIntFilter the list using the media group IDNo

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 = 20;   
    $post = array();
    $post['mgid'] = 1;
    $post['mg_name'] = 'testWindows';

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Media Groups",
    "mediagroups": {
        "1": {
            "mgid": "1",
            "mg_name": "testWindows",
            "mg_desc": "Test windows group for WHMCS",
            "mg_type": "kvm",
            "mg_media": {
                "314": "ubuntu-14.04-x86_64",
                "446": "ubuntu-16.04-x86_64"
            }
        }
    },
    "timenow": 1540279446,
    "time_taken": "0.084"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list