API Edit User

From Virtualizor Wiki
Jump to: navigation, search

Edit User

POST PARAMETERS
uid : The id of the user

Parameters Description
priority The user type (0 = admin / 1 = end-user)
newemail The email address of the user
newpass The password of the user
uid The id of the user to be edited

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['priority']   = '0';
    $post['newemail']   = 'test@test.com';
    $post['newpass']    = '';
    $post['uid']	= '1';

    $output = $admin->edituser($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Edit User
    [done] => 1
    [users] => Array
        (
            [uid] => 1
            [password] => xxxxxxxxxxxxxxxxxxnDGfpgs3T9z/
            [email] => test@test.com
            [type] => 0
            [aclid] => 0
            [pid] => 0
            [num_vs] => 0
            [num_users] => 0
            [space] => 0
            [ram] => 0
            [burst] => 0
            [bandwidth] => 0
            [cpu] => 0
            [cores] => 4
            [cpu_percent] => 0
            [num_ipv4] => 0
            [num_ipv6] => 0
            [openvz] => 0
            [xen] => 0
            [xenhvm] => 0
            [kvm] => 0
            [sg] => Array
                (
                    [0] => 0
                )

            [mg] => Array
                (
                    [0] => 0
                )

            [preferences] => 
            [dnsplid] => 0
        )

    [mgs] => Array
        (
            [1] => Array
                (
                    [mgid] => 1
                    [mg_name] => test
                    [mg_desc] => test
                    [mg_type] => kvm
                )

        )

    [servergroups] => Array
        (
            [0] => Array
                (
                    [sgid] => 0
                    [sg_name] => Default
                    [sg_desc] => Default Group
                    [sg_select] => 0
                )

            [2] => Array
                (
                    [sgid] => 2
                    [sg_name] => Group 1 [ US East ]
                    [sg_desc] => Group 1 [ US East ] description
                    [sg_select] => 0
                )

        )

    [timenow] => 1403162098
    [time_taken] => 0.017
)