Child pages
  • cPanel API 2 Functions - Ftp::addftp

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt
This function creates an FTP account.


Warning
titleWarning:

We strongly recommend that you use the following UAPI function instead of this function:

  • Ftp::add_ftp

    Excerpt Include
    DD:UAPI Functions - Ftp::add_ftp
    DD:UAPI Functions - Ftp::add_ftp
    nopaneltrue

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledFTPRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleWHM API (JSON)


Code Block
languagetext
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_func=addftp&user=user&pass=12345luggage&quota=12345&homedir=userftp

Include Page
LIB:_CallFromWHMAPILink
LIB:_CallFromWHMAPILink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Add new FTP user "user" with password "12345luggage"
$add_ftp = $cpanel->api2(
    'Ftp', 'addftp',
 array(
        'user'    => 'newuser',
        'pass'    => '12345luggage',
        'quota'   => '12345',
        'homedir' => 'newuserftp',
 ) 
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

 


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Add new FTP user "user" with password "12345luggage"
my $add_ftp = $cpliveapi->api2(
    'Ftp', 'addftp',
{ 
        'user'    => 'newuser',
        'pass'    => '12345luggage',
        'quota'   => '12345',
        'homedir' => 'newuserftp',
   }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelAPI2cPanelTagsWarning
LIB:_cPanelAPI2cPanelTagsWarning


Expand
titleCommand Line


Code Block
languagebash
cpapi2 --user=username Ftp addftp user=user pass=12345luggage

Include Page
LIB:_cPanelAPI2CLINote
LIB:_cPanelAPI2CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "cpanelresult": {
    "apiversion": 2,
    "func": "addftp",
    "data": [
      {
        "reason": "OK",
        "result": 1
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Ftp"
  }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote

   


Parameters

ParametersTypeDescriptionPossible valuesExample
userstring

Required

The FTP account's username.

A valid username.user
passstring

Required

The new password.

A valid password.12345luggage
domainstring

The user's associated domain.

This parameter defaults to the cPanel account's primary domain.

A domain that the cPanel account owns. example.com
quotainteger

The new FTP account's quota.

This value defaults to 0, which grants an unlimited quota.

  • A positive integer.
  • 0 — Unlimited quota.
12345
homedirstring

The path to the user's home directory.

If you do not specify a path, the FTP account uses the cPanel account's home directory.

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

Returns

Return TypeDescriptionPossible valuesExample
reasonstring

A reason for failure.

Note
titleNote:

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