cPanel API 2 Functions - WebDisk::addwebdisk
The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.
Description
This function creates a Web Disk account.
We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
When you disable the Web Disk role, the system disables this function.
Examples
WHM API (JSON)
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
For more information, read our Calls from the WHM API documentation.
LiveAPI PHP Class
$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',
)
);
For more information, read our Guide to the LiveAPI System.
LiveAPI Perl Module
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',
}
);
For more information, read our Guide to the LiveAPI System.
cPanel Tag System (deprecated)
- cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
- cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
- For more information, read our Deprecated cPanel Tag Usage documentation.
Command Line
cpapi2 --user=username WebDisk addwebdisk domain=example.com user=user password=12345luggage homedir=public_html%2Fwebdav%2F private=1 enabledigest=1 perms=rw
- You must URI-encode values.
-
username
represents your account-level username. -
You
must
include the
--user=username
option. -
For more information and additional output options, read our
Guide to cPanel API 2
documentation or run the
cpapi2 --help
command. -
If you run CloudLinux™, you
must
use the full path of the
cpapi2
command:/usr/local/cpanel/bin/cpapi2
Output (JSON)
{
"cpanelresult": {
"apiversion": 2,
"func": "addwebdisk",
"data": [
{
"enabledigest": 1,
"domain": "example.com",
"user": "user",
"perms": "rw",
"login": "user@example.com"
}
],
"event": {
"result": 1
},
"module": "WebDisk"
}
}
Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameters | Type | Description | Possible values | Example |
---|---|---|---|---|
domain |
string | Required The account's domain name. |
A valid domain name. | example.com |
user |
string | Required The account's username. |
A valid username. | user |
password |
string |
The account's password. You must use either the |
A valid password. | 12345luggage |
perms |
string | Required Whether to grant a user write permissions to the user. |
|
ro |
homedir |
string | The path to account's directory. |
A valid directory path, relative to the cPanel account's home directory. | public_html/webdav/ |
private |
Boolean | Whether to set the directory's permissions to public or private. This value defaults to |
|
1 |
enabledigest |
Boolean | Whether to enable Digest Authentication. This value defaults to |
|
1 |
password_hash |
string |
The account's password hash. You must use either the
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 |
|
digest_auth_hash |
string |
The account's digest authentication hash. You must use this parameter if you use the
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. |
Returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
domain |
string | The account's domain name. | A valid domain name. | example.com |
user |
string | The account's username. | A valid username. | user |
|
string | The account's permissions. |
|
rw |
login |
string | The account's full username. | The full username, which includes the at symbol (@ ) and the domain name. |
user@example.com |
reason |
string |
A reason for failure. This function only returns a |
A string that describes the error. |
This is an error message. |
result |
boolean | Whether the function succeeded. |
|
1 |