cPanel API 2 Functions - WebDisk::addwebdisk

Warning:

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.

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.


Important:

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
Note:

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',
  )
);
Note:

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',
    }
);
Note:

For more information, read our Guide to the LiveAPI System.


cPanel Tag System (deprecated)

Warning:
  • 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
Notes:
  • 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"
    }
}
Note:

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 password parameter or the password_hash parameter, but you cannot use both.

A valid password. 12345luggage
perms string

Required

Whether to grant a user write permissions to the user.

  • rw — Read-Write permissions.
  • ro — Read-only permissions
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 0.

  • 1 — Private (0700).
  • 0 — Public ( 0755 ).
1
enabledigest Boolean

Whether to enable Digest Authentication.

This value defaults to 0 .

  • 1 — Enable Digest Authentication.
  • 0 — Disable Digest Authentication.
1
password_hash string

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_hash string

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 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

perms

string The account's permissions.
  • rw — Read-Write permissions.
  • ro — Read-only 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 reason value if it failed.

A string that describes the error.

This is an error message.
result boolean

Whether the function succeeded.

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