Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Sep 2007
    Posts
    138

    Default xml api2 delete addon domain help.

    I am trying to delete an addon domain but I am getting

    <cpanelresult>
    <apiversion>2</apiversion>
    <data>
    <reason>Error from park wrapper: Sorry, you do not control the domain
    </reason>
    <result>0</result>
    </data>
    <func>deladdondomain</func>
    <module>AddonDomain</module>
    </cpanelresult>


    This is the call that I am doing.

    http://127.0.0.1:2086/xml-api/cpanel?user=$owner&xmlin=&xmlin=<cpanelaction><module>AddonDomain</module><func>deladdondomain</func><args>$addomain</args>$subdomain<args></args></cpanelaction>

    I am using the access hash for root to authenticate. Is this an easier way to do this?

    I am calling it from a perl script.

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Could you please open a ticket on this at tickets.cpanel.net/submit

    please title this ticket: ATTN matt (cannot remove addondomain via API)

    I will also need access to your server along with information on how to reproduce the issue (how to run your script, etc)
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Sep 2007
    Posts
    138

    Default

    Can you just provide an example of how the call is supposed to work?

    The following is the cpanel error log.

    2009-11-11 16:27:45 warn [addondomain::deladdondomain] Encountered error in addondomain::deladdondomain: Error from park wrapper: Sorry, you do not control the domain
    at /usr/local/cpanel/Cpanel/EventHandler.pm line 48
    Cpanel::EventHandler::event(2, 'post', 'addondomain', 'deladdondomain', HASH(0x91e2c64), ARRAY(0xb91e614)) called at cpanel.pl line 5018
    main::api2_exec('AddonDomain', 'deladdondomain', HASH(0xb91e4f4), ARRAY(0xb91e47c)) called at cpanel.pl line 1571
    main::docpanelaction('<cpanelaction><module>AddonDomain</module><func>deladdondomain</func><args>addondomain1.com</args><args>addondomain1.test.c1sc0.org</args></cpanelaction>') called at cpanel.pl line 4816
    main::dotag(undef) called at cpanel.pl line 4691
    main::cpanel_parseblock(SCALAR(0x92bdcac)) called at cpanel.pl line 1238
    Last edited by sirdopes; 11-11-2009 at 11:37 AM.

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    1

    Default

    This code is working for me. I hope it will solve your problem.


    PHP Code:
    $request "/frontend/x3/addon/dodeldomain.html?domain=$domain&subdomain=$subdomain";
            
                   
                         
    $sock = @fsockopen($this->host,2082);
                 if(!
    $sock)
                 {
                            return 
    false;
                 }

                 
    $authstr "$this->user:$this->pass";
                 
    $pass base64_encode($authstr);
                 
    $in "GET $request\r\n";
                 
    $in .= "HTTP/1.0\r\n";
                 
    $in .= "Host:$this->host\r\n";
                 
    $in .= "Authorization: Basic $pass\r\n";
                 
    $in .= "\r\n";
                 
    //process
                 
    fputs($sock$in);
                 while (!
    feof($sock)) {
                
    $result .= fgets ($sock1028);
                 }
                 
    fclose$sock ); 

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    2

    Default

    Noticed this here with no real answer. I just ran into issues with deladdondomain myself, using the xmlapi.php wrapper.

    I can easily do something like:

    Code:
    $result= $xmlapi->api2_query(CPANEL_XMLAPI_USER, 'AddonDomain', 'addaddondomain',
    		array("newdomain" => "somedomain.com",
    			"subdomain" => "somedomain",
    			"dir" => $dir,
    			"pass" => $pass));
    
    $listresult = $xmlapi->listaddondomains(CPANEL_XMLAPI_USER);
    ...and it will add the domain and display it in the list of domains. But if I then try the following:

    Code:
    $result = $xmlapi->api2_query(CPANEL_XMLAPI_USER, 'AddonDomain', 'deladdondomain',
    		array("domain" => "somedomain.com",
    			"subdomain" => "somedomain"));
    ...it will fail with an error: "Error from park wrapper: Sorry, I do not believe you control the subdomain for somedomain.com."

    After fiddling around with this, particularly looking at the links which are being generated by the addon control panel, I figured it out. Apparently the API treats the subdomain parameter differently between the addaddondomain call and the deladdondomain call.

    For the deladdondomain call, what it wants in subdomain is NOT the subdomain, but instead the user name plus main domain name which the addaddondomain command added to your account. This is what is returned as the "domainkey" field in the listaddondomains results. So the following code:

    Code:
    $result = $xmlapi->api2_query(CPANEL_XMLAPI_USER, 'AddonDomain', 'deladdondomain',
    		array("domain" => "somedomain.com",
    			"subdomain" => "somedomain_maindomain.com"));
    ...is what's needed to actually work, at least going through the PHP API. I'm not sure why this is the case, it contradicts the docs, so it's either a bug, or incorrect documentation. (As a sanity check to make sure I wasn't misinterpreting the docs, I tried changing the addaddondomain call to use the "somedomain_maindomain.com" format, and it didn't like that.)

    Having solved the issue, I wanted to post it here so others who are having trouble can find the solution.

    FYI, I've been doing this on CPanel 11.25 running on a shared hostgator account.

Similar Threads & Tags
Similar threads

  1. Replies: 5
    Last Post: 01-28-2012, 04:42 AM
  2. How to Copy file between account with xml-api, api2?
    By gennerp in forum cPanel Developers
    Replies: 1
    Last Post: 04-14-2011, 10:00 AM
  3. Trouble with XML API2 Email::storefilter
    By jSeeDev in forum cPanel Developers
    Replies: 5
    Last Post: 09-26-2010, 09:51 AM
  4. Security Question, xml-api, api2
    By willsmelser in forum cPanel Developers
    Replies: 3
    Last Post: 12-25-2009, 12:58 AM
  5. XML API for Addon Domain Redirection
    By intrwrks in forum cPanel Developers
    Replies: 0
    Last Post: 12-11-2009, 09:14 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube