Get Virtualizor

Add Media Groups

Use the Add Media Groups API to create a media groups on the server. 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. The API response will contain "done" as "true" on successful creation of the media group.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETaddmgThe action specified to perform operation will return "done" as "true" on successYes
mg_namePOSTtextName for the media groupYes
mg_descPOSTtextThe description of the media groupYes
mg_typePOSTtextType of media groupYes

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['mg_name'] = 'testing for api';
    $post['mg_desc'] = 'Testing for the api';
    $post['mg_type'] = 'kvm';

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

    print_r(json_encode($output));

?>

Output

{
    "title": "Add Media Group",
    "done": true,
    "timenow": 1536088189,
    "time_taken": "0.213"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list