Description

This function creates a Web Disk account.

Examples




https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=WebDisk&cpanel_jsonapi_func=addwebdisk&domain=example.com&user=user&password=12345luggage&homedir=%2Fhome%2Fexample%2Fpublic_html%2Fwebdav%2F&private=0&enabledigest=1&perms=rw



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Create the "user@example.com" webdisk account with password "12345luggage"
$create_webdisk = $cpanel->api2(
    'WebDisk', 'setstatus',
 array(
        'domain' => 'example.com',
        'user' => 'user',
        'password' => '12345luggage',
        'homedir' => 'public_html/webdav/',
        'private' => '1',
        'enabledigest' => '1',
        'perms' => 'rw',
  ) 
);

 



my $cpliveapi = Cpanel::LiveAPI - > new();#
Connect to cPanel - only do this once.
	#
	Create the "user@example.com"
webdisk account with password "12345luggage"
my $create_webdisk = $cpliveapi - > api2(
	'WebDisk', 'setstatus', {
		'domain' => 'example.com',
		'user' => 'user',
		'password' => '12345luggage',
		'homedir' => 'public_html/webdav/',
		'private' => '1',
		'enabledigest' => '1',
		'perms' => 'rw',
	}
);

 




cpapi2 --user=username WebDisk addwebdisk domain=example.com user=user password=12345luggage homedir=public_html%2Fwebdav%2F private=1 enabledigest=1 perms=rw



{
	"cpanelresult": {
		"apiversion": 2,
		"func": "addwebdisk",
		"data": [
            {
			"enabledigest": 1,
			"domain": "example.com",
			"user": "user",
			"perms": "rw",
			"login": "user@example.com"
         		}
        ],
		"event": {
			"result": 1
		},
		"module": "WebDisk"
	}
}



Parameters

ParametersTypeDescriptionPossible valuesExample
domainstring

Required

The account's domain name.

A valid domain name.example.com
userstring

Required

The account's username.

A valid username.user
passwordstring

The account's password.

You must use either the password parameter or the password_hash parameter, but you cannot use both.


A valid password.12345luggage
permsstring

Required

Whether to grant a user write permissions to the user.

  • rw — Read-Write permissions.
  • ro — Read-only permissions
ro
homedirstring

The path to account's directory.

A valid directory path, relative to the cPanel account's home directory.public_html/webdav/
privateBoolean

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

This value defaults to 0.

  • 1 — Private (0700).
  • 0 — Public ( 0755 ).
1
enabledigestBoolean

Whether to enable Digest Authentication.

This value defaults to 0 .

  • 1 — Enable Digest Authentication.
  • 0 — Disable Digest Authentication.
1
password_hashstring

The account's password hash.

You must use either the password parameter or the password_hash parameter, but you cannot use both.


We introduced this parameter in cPanel & WHM version 54.


A valid password hash that utilizes your server's cryptographic hash function.

You can find your server's hash type in the /etc/sysconfig/authconfig file.



$6$1sOyHP5ZDYp3pGUz$R0TSgfPRHfDjT5PP5RJGv39FhiGTNNPvM7IFpCBjXijMmlMZk9yI8T3LqGuntc9fdKb5eX.lGL7wBS9e4DAWn/


digest_auth_hashstring

The account's digest authentication hash.

You must use this parameter if you use the password_hash parameter.


We introduced this parameter in cPanel & WHM version 54.


A valid digest authentication hash that uses the MD5 cryptographic hash function.

For more information, read Wikipedia's Digest Access Authentication documentation.



6ca48e22b86fa074b72ef0e598ea9d66


Returns

Return TypeDescriptionPossible valuesExample
domainstringThe account's domain name.A valid domain name.example.com
userstringThe account's username.A valid username.user

perms

stringThe account's permissions.
  • rw — Read-Write permissions.
  • ro — Read-only permissions
rw
loginstringThe account's full username.The full username, which includes the at symbol (@) and the domain name.user@example.com
reasonstring

A reason for failure.

This function only returns a reason value if it failed.


A string that describes the error.

This is an error message.
resultboolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1