API Add Media Group

From Virtualizor Wiki
Jump to: navigation, search
NOTE
This is OLD API Documentation. Click on the following link for New API Documentation
Admin API

Add a media group

Parameters Type Description
addmg POST Flag to create a Media group (This has to be 1)
mg_name POST The unique name for the media group
mg_desc POST Short description for the media group
mg_type POST The virtualization type for the media group (openvz / kvm / xen / xenhvm / xcp/ xcpkvm)

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

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

    $post = array();
    $post['addmg'] = 1;
    $post['mg_desc'] = 'apitest';
    $post['mg_name'] = 'apitest';
    $post['mg_type'] = 'openvz';
	
    $output = $admin->addmg($post);
?>

Returns:

Array
(
    [title] => Add Media Group
    [done] =>  1
    [timenow] => 1348126304
    [time_taken] => 0.012
)