Description

This function edits a Subaccount.


Examples




https://hostname.example.com:2083/cpsess##########/execute/UserManager/edit_user?alternate_email=robert%40example.com&domain=example.com&password=12345luggage&real_name=Bob%20Doe&services.email.enabled=1&services.email.quota=2&services.ftp.enabled=1&services.ftp.homedir=%2Fbob&services.webdisk.enabled=1&services.webdisk.private=0&services.webdisk.homedir=%2Fbob&services.webdisk.perms=0&type=sub&username=example1



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Edit Subaccount.
$Usermanager = $cpanel->uapi(
    'UserManager', 'edit_user',
	array(
		'alternate_email'			=>	'robert@example.com',
		'domain'					=>	'example.com',
		'password'					=>	'12345luggage',
		'real_name'					=>	'Bob Doe',
		'services.email.enabled'	=>	'1',
		'services.email.quota'		=>	'2',
		'services.ftp.enabled'		=>	'1',
		'services.ftp.homedir'		=>	'/bob',
		'services.webdisk.enabled'	=>	'1',
		'services.webdisk.private'	=>	'0',
		'services.webdisk.homedir'	=>	'/bob',
		'services.webdisk.perms'	=> 	'0',
		'type'						=>	'sub',
		'username'					=>	'example1',
		)
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Edit Subaccount.
my $Usermanager = $cpliveapi->uapi(
    'UserManager', 'edit_user',
	{
		'alternate_email'			=>	'robert@example.com',
		'domain'					=>	'example.com',
		'password'					=>	'12345luggage',
		'real_name'					=>	'Bob Doe',
		'services.email.enabled'	=>	'1',
		'services.email.quota'		=>	'2',
		'services.ftp.enabled'		=>	'1',
		'services.ftp.homedir'		=>	'/bob',
		'services.webdisk.enabled'	=>	'1',
		'services.webdisk.private'	=>	'0',
		'services.webdisk.homedir'	=>	'/bob',
		'services.webdisk.perms'	=> 	'0',
		'type'						=>	'sub',
		'username'					=>	'example1',
	}
);



<!-- Edit Subaccount. -->
[% execute('UserManager', 'edit_user', {'alternate_email' => 'robert@example.com', 'domain' => 'example.com', 'password' => '12345luggage', 'real_name' => 'Bob Doe', 'services.email.enabled' => '1', 'services.email.quota' => '2', 'services.ftp.enabled' => '1', 'services.ftp.homedir' => '/bob', 'services.webdisk.enabled' => '1', 'services.webdisk.private' =>  '0', 'services.webdisk.homedir' => '/bob', 'services.webdisk.perms' => '0', 'type' => 'sub', 'username' => 'example1'} ) %]



uapi --user=username UserManager edit_user alternate_email=robert%40example.com domain=example.com password=12345luggage real_name='Bob Doe' services.email.enabled=1 services.email.quota=2 services.ftp.enabled=1 services.ftp.homedir=%2Fbob services.webdisk.enabled=1 services.webdisk.private=0 services.webdisk.homedir=\/bob services.webdisk.perms=0 type=sub username=example1



{  
   "errors":null,
   "status":1,
   "messages":null,
   "metadata":{  

   },
   "data":{  
      "dismissed_merge_candidates":[  

      ],
      "invite_expiration":null,
      "avatar_url":null,
      "synced_password":1,
      "full_username":"example1@example.com",
      "merge_candidates":[  

      ],
      "type":"sub",
      "real_name":"Bob Doe",
      "can_set_quota":0,
      "domain":"example.com",
      "parent_type":null,
      "alternate_email":"rob@example.com",
      "can_delete":1,
      "sub_account_exists":0,
      "special":0,
      "username":"example1",
      "issues":[  

      ],
      "has_expired_invite":0,
      "dismissed":0,
      "can_set_password":1,
      "guid":"EXAMPLE1:EXAMPLE.COM:577D1D1A:69E2308AFB4F1FDAFE67CCCD8A33785DCCDEC199124A6CC0397F86A2789B7E03",
      "services":{  
         "email":{  
            "enabled":1,
            "quota":2
         },
         "ftp":{  
            "enabled":1,
            "quota":"42.00",
            "homedir":"bob"
         },
         "webdisk":{  
            "homedir":"bob",
            "enabled":1,
            "enabledigest":1,
            "private":0,
            "perms":"rw"
         }
      },
      "phone_number":null,
      "has_siblings":0,
      "has_invite":0
   }
}



Parameters

ParameterTypeDescriptionPossible valuesExample
alternate_emailstring

An alternate email address for the Subaccount's user.

The cPanel account user could use this email address to contact the Subaccount user if their primary email address's domain is unavailable.

This parameter defaults to null.

A valid email address.

user@example.com
avatar_urlstring

The user's Subaccount profile photo.

This parameter defaults to null.

A valid HTTPS URL that points to an image file.

You must use the HTTPS protocol to prevent mixed content warnings when users view the photo from another HTTPS URL.



https://img.example.com/avatars/example.jpg


domainstring

Required

The Subaccount user's associated domain.

A domain that the cPanel account owns.

example.com
passwordstring

Required

The Subaccount's password.

The Subaccount uses this password for email, FTP, and Web Disk services.


A secure password.12345luggage
phone_numberstring

The Subaccount user's phone number.

This parameter defaults to null.

A valid phone number that conforms to ITU-T's E.164 -recommended standard for the representation of telephone numbers.+15551234567
real_namestring

The Subaccount user's name.

This parameter defaults to null.

  • A first name.
  • A last name.
  • A first name and last name.
  • An empty string.
John Doe
services.email.enabledBoolean

Whether to grant the Subaccount email access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0Cannot access.
1
services.email.quotainteger

The maximum amount of disk space that the subaccount's email account may use.

We introduced this functionality in cPanel & WHM version 70.

This parameter defaults to the defined system value.

  • A positive integer that represents the maximum amount of disk space, in Megabytes (MB).

    This value cannot be greater than the maximum email quota.


  • 0 or unlimited — The subaccount possesses unlimited disk space.


500

services.ftp.enabledBoolean

Whether to grant the Subaccount FTP access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0Cannot access.
1
services.ftp.homedirstring

The Subaccount's FTP home directory.

This parameter is required if you enabled FTP access.


A relative path from the cPanel account's home directory.

The specified directory must exist.


/Subaccount
services.webdisk.enabledBoolean

Whether to grant the Subaccount Web Disk access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0Cannot access.
1
services.webdisk.enabledigestBoolean

Whether to enable Web Disk digest authentication.

  • Only enable Digest Authentication for clients that require additional compatibility support on certain versions of Windows® operating systems. This compatibility support is only required on servers that use a self-signed certificate for the cpsrvd and cpdavd daemons.
  • We recommend that you do not use Digest Authentication.

This parameter defaults to 0.

  • 1 — Enabled.
  • 0 — Disabled.
0
services.webdisk.privateBoolean

Whether to set the Web Disk directory's permissions to public or private.

This parameter defaults to 0.

  • 1 — Private (0700).
  • 0 — Public (0755).
1
services.webdisk.homedirstring

The Subaccount's Web Disk home directory.

This parameter is required if you enable Web Disk access.


A valid path, relative to the cPanel account's home directory.

/Subaccount
services.webdisk.permsstring

Whether to grant write permissions to the Subaccount.

The services.webdisk.homedir parameter determines the Subaccount's Web Disk home directory.

This parameter defaults to rw.

  • ro — Read-only permissions.
  • rw — Read and write permissions.
rw
typestring

The type of account.

This parameter defaults to sub.

sub — A Subaccount.

sub
usernamestring

Required

The Subaccount's username.

 

A username that meets the Subaccount name limitations.

  • Length — 64 characters.
  • Characters — a-z, A-Z, 0-9, dot(.), hyphen(-), underscore(_).

This value does not include the domain name.


example

Returns