The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

create FTP, email and remove a parked domain using xml api

Discussion in 'cPanel Developers' started by nhk15, Mar 27, 2009.

  1. nhk15

    nhk15 Registered

    Joined:
    Mar 16, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    Does anyone know how to create a ftp/email account using xml api?
    also would you able to tell me which function remove a parked domain?


    Cheers,
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Here's a thread on parking a domain:

    http://forums.cpanel.net/showthread.php?t=69519

    To unpark a domain, simply use the unpark function instead of the park function. The syntax is the same.

    To create an email account, use the addpop function described in this thread:

    http://forums.cpanel.net/showthread.php?t=89749

    To create a FTP account, use this API1 function:

    Code:
    <cpanel Ftp="addftp(login, password, homedir, quota,,homedir)">
    
    login = FTP username without @domain (cPanel adds that automatically)
    password = FTP password
    homedir = directory to which the FTP account has access
    quota = FTP user's quota in megabytes

    The above threads explain how to call API1 functions from the XML API, but we also have documentation for that at http://cPanel.net/plugins/xmlapi
     
  3. clusterkiller

    clusterkiller Registered

    Joined:
    Jan 26, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    I´ve got the following result, if i try to add a FTP-Account:
    Code:
    <fatalerror>[a fatal error or timeout occurred while processing this directive]</fatalerror><fatalerror>[a fatal error or timeout occurred while processing this directive]</fatalerror>
    My call:
    Code:
    https://xxxxx:2087/xml-api/cpanel?user=xxxxx&xmlin=<cpanelaction>
    <module>Ftp</module>
    <func>addftp</func>
    <apiversion>1</apiversion>
    <args>user1</args>
    <args>asdfölkj123</args>
    <args>/</args>
    <args>4700</args>
    </cpanelaction>
    Is the Module-Name wrong ?
    Where is the error ?

    Thank you for helping.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I actually copy/pasted your URL, placed it on a single line and substituted a username and hostname and it worked fine for me. So I recommend seeing if updating your cPanel/WHM fixes this. Also, if you are using port 2087, make sure you are logged in as a reseller user (or root user). If you only have cPanel access, you can use ports 2082 and 2083 instead for the XML API.
     
  5. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    When that happens, what is in /usr/local/cpanel/logs/error_log?
     
  6. clusterkiller

    clusterkiller Registered

    Joined:
    Jan 26, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    The logfile give the following output (with xml-api executed as root-user):
    Code:
    (internal death while parsing ) Fri Apr 10 13:24:06 2009 [16332] error:
    not well-formed (invalid token) at line 1, column 107, byte 107 at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 187
     at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser/Expat.pm line 478
            XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0x152a8970)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 187
            eval {...} called at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 186
            XML::Parser::parse('XML::Parser=HASH(0x15298ab0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Expat.pm line 60
            XML::SAX::Expat::_parse_string('XML::SAX::Expat=HASH(0x150e03e0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Base.pm line 2602
            XML::SAX::Base::parse('XML::SAX::Expat=HASH(0x150e03e0)', 'HASH(0x15353890)') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Base.pm line 2655
            XML::SAX::Base::parse_string('XML::SAX::Expat=HASH(0x150e03e0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 370
            XML::Simple::build_tree('XML::Simple=HASH(0x150799c0)', 'undef', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 308
            XML::Simple::build_simple_tree('XML::Simple=HASH(0x150799c0)', 'undef', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 270
            XML::Simple::parse_string('XML::Simple=HASH(0x150799c0)', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 171
            XML::Simple::XMLin('SCALAR(0x14fa0280)') called at /usr/local/cpanel/Cpanel/XMLParser_ExtPerlMod.pm line 20
            Cpanel::XMLParser_ExtPerlMod::XMLin('HASH(0x14e46fe0)') called at - line 5
    
    
    (internal death while parsing ) Fri Apr 10 13:24:06 2009 [16332] error:
    not well-formed (invalid token) at line 1, column 107, byte 107 at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 187
     at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 192
            XML::Parser::parse('XML::Parser=HASH(0x15298ab0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Expat.pm line 60
            XML::SAX::Expat::_parse_string('XML::SAX::Expat=HASH(0x150e03e0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Base.pm line 2602
            XML::SAX::Base::parse('XML::SAX::Expat=HASH(0x150e03e0)', 'HASH(0x15353890)') called at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/Base.pm line 2655
            XML::SAX::Base::parse_string('XML::SAX::Expat=HASH(0x150e03e0)', '<cpanelaction><module>Ftp</module><func>addftp</func><apivers...') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 370
            XML::Simple::build_tree('XML::Simple=HASH(0x150799c0)', 'undef', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 308
            XML::Simple::build_simple_tree('XML::Simple=HASH(0x150799c0)', 'undef', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 270
            XML::Simple::parse_string('XML::Simple=HASH(0x150799c0)', 'SCALAR(0x14fa0280)') called at /usr/lib/perl5/site_perl/5.8.8/XML/Simple.pm line 171
            XML::Simple::XMLin('SCALAR(0x14fa0280)') called at /usr/local/cpanel/Cpanel/XMLParser_ExtPerlMod.pm line 20
            Cpanel::XMLParser_ExtPerlMod::XMLin('HASH(0x14e46fe0)') called at - line 5
    
    
    
    not well-formed (invalid token) at line 1, column 107, byte 107 at /usr/lib/perl5/site_perl/5.8.8/x86_64-linux/XML/Parser.pm line 187
    (internal death while parsing ) Fri Apr 10 13:24:06 2009 [16330] error: File is not a perl storable at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/Storable.pm line 398.
            eval {...} called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/Storable.pm line 398
            Storable::fd_retrieve('GLOB(0x2b519afa8060)') called at /usr/local/cpanel/Cpanel/ExtPerlMod.pm line 58
            Cpanel::ExtPerlMod::func('Cpanel::XMLParser_ExtPerlMod::XMLin', 'HASH(0x21a4ea0)', 1) called at /usr/local/cpanel/Cpanel/XMLParser.pm line 32
            Cpanel::XMLParser::XMLin('SCALAR(0x220f470)') called at cpanel.pl line 1506
            eval {...} called at cpanel.pl line 1506
            main::docpanelaction('<cpanelaction><module>Ftp</module><func>addftp</func><apiversion...') called at cpanel.pl line 4750
            main::dotag(undef) called at cpanel.pl line 4625
            main::cpanel_parseblock('SCALAR(0x232ffc0)') called at cpanel.pl line 1223
    
    
    (internal death while parsing ) Fri Apr 10 13:24:06 2009 [16330] error: File is not a perl storable at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/Storable.pm line 398, at /usr/local/cpanel/Cpanel/ExtPerlMod.pm line 58
            Carp::croak('File is not a perl storable at /usr/lib/perl5/site_perl/5.6.2/x8...') called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/Storable.pm line 76
            Storable::logcroak('File is not a perl storable at /usr/lib/perl5/site_perl/5.6.2/x8...') called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/Storable.pm line 399
            Storable::fd_retrieve('GLOB(0x2b519afa8060)') called at /usr/local/cpanel/Cpanel/ExtPerlMod.pm line 58
            Cpanel::ExtPerlMod::func('Cpanel::XMLParser_ExtPerlMod::XMLin', 'HASH(0x21a4ea0)', 1) called at /usr/local/cpanel/Cpanel/XMLParser.pm line 32
            Cpanel::XMLParser::XMLin('SCALAR(0x220f470)') called at cpanel.pl line 1506
            eval {...} called at cpanel.pl line 1506
            main::docpanelaction('<cpanelaction><module>Ftp</module><func>addftp</func><apiversion...') called at cpanel.pl line 4750
            main::dotag(undef) called at cpanel.pl line 4625
            main::cpanel_parseblock('SCALAR(0x232ffc0)') called at cpanel.pl line 1223
    
    
    2009-04-10 11:24:06 info [cpanel] xml-api/cpanel call failed. Module name is required.
    
    cPanel is up2date.

    Thank you for reply.
     
Loading...

Share This Page