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.