cPanel API 2 Functions - WebDisk::addwebdisk

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.

 

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

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

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

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read ourDeprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.


 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.

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

Important:

 You must use either thepassword parameter or thepassword_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.

Important:

You must use either thepassword parameter or thepassword_hash parameter, but you cannot use both.

 

Note:

We introduced this parameter in cPanel & WHM version 54.

 

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

Note:

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

 

 digest_auth_hash 

string

The account's digest authentication hash.

Important:

You must use this parameter if you use thepassword_hash parameter.

 

Note:

We introduced this parameter in cPanel & WHM version 54.

 

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

 

 

 

  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....