addftp API2 call failing - "Failed to determine FTP account xxxx directory"

filmotheklown

Member
Oct 3, 2006
15
1
151
My call to the addftp xmlapi just failed and I can't figure out why:

It has been working up until today.

Here's the result dump (from php). "USERNAME" is substituted for the user name we were trying to assign a ftp account to. I've tried a couple different usernames/passwords, same results.
Code:
Array
(
    [cpanelresult] => Array
        (
            [data] => Array
                (
                    [0] => Array
                        (
                            [result] => 0
                            [reason] => Failed to determine FTP account USERNAME directory.
                        )

                )

            [event] => Array
                (
                    [result] => 1
                )

            [module] => Ftp
            [apiversion] => 2
            [func] => addftp
        )
)
If I look in the directory where it's attempting to create the user folder, it appears to have succeeded. The user folder is there and set 0755

The user names and passwords I'm passing are also valid choices.

WHM 11.28.87
CENTOS 5.5 i686 standard

????
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
Houston, TX
cPanel Access Level
Root Administrator
Hi filmoftheklown,

Can you place post a copy of either a snippet of PHP script (in which you are making you XML-API query) or the query URL with the parameters. It's like that there's some parameter keys that aren't being properly interpreted by the XML-API binary.

(if you're using our XML-API PHP client class, you can retrieve that URL from the PHP error_log with you enable debugging, ie. $xmlapi->set_debug(1))

Regards,
-DavidN
 

filmotheklown

Member
Oct 3, 2006
15
1
151
Figured it out. cPanel API doesn't like it when you pass it a login in WordCase. Only seems to work in lowercase. Fixed the problem by using:

$login = strtolower($login);

Before executing the XMLAPI call.

Didn't try entirely UPPERCASE login, but definitely did not like WordCase logins.

PS: I had prior assumed that login could be either mixed case or uppercase as a valid parameter.
 

solcre

Registered
Apr 19, 2011
4
0
51
I'm having the same problem it looks like it wants to create an annonymous account also... what the hell ?
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
Houston, TX
cPanel Access Level
Root Administrator
I haven't tested the uppercase/mixedcase scenario, but it makes sense to me that all characters should be lowercase.

Other points to consider when using API2 Ftp::addftp:

1) If you're making the call remotely via the XML-API, make sure you're using a version of the PHP XML-API class that is version 1.0.6 or higher (if you're coding in PHP and wish to use this class), or at least make sure you observe the need to differentiate the URL parameters for the function versus the XML-API parser (essentially, use 'cpanel_xmlapi_user' or 'cpanel_jsonapi_user' to itemize the cPanel user account and 'user' to describe the new FTP account name [otherwise two key-pair values with the same key in the URL will get munged when processed by the XML-API parser])

2) Ensure that the 'user' parameter for the Ftp::addftp function is simply the unique portion of the FTP login. i.e. if your domain is dave.com and you intend to FTP into you account using '[email protected]' you should set the 'user' value to 'webdeveloper'...no @$domain

3) API2 Ftp::addftp does not allow for periods (the "dot" character) in the 'user' value. If you need such a FTP username, for example 'web.developer', use the API1 equivalent which allows for that sort of fine-grained' validation.

-DavidN