Cannot remove addon domains via API2

blade304

Member
Jul 3, 2017
8
0
1
PL
cPanel Access Level
Root Administrator
Hi there,

I'm trying to remove an addon domain using the deladdondomain function from API2:

Code:
$xmlapi->api2_query($account, "AddonDomain", "deladdondomain",
            [
                'domain'      => $dom,
                'subdomain'      => $subdom
            ]
        );
But I get the following error:
Code:
The subdomain 13cptesttld does not correspond to 13cptest.tld.
Well, it does. I checked it. So why am I getting this error?
 

blade304

Member
Jul 3, 2017
8
0
1
PL
cPanel Access Level
Root Administrator
Hey there! Can you let me know the full API command you're using so I can test that?
Thanks, I already managed to solve that. I needed to add the domain name for the cPanel account (example.com) to the subdomain. So instead of 13cptesttld, 13cptesttld.example.com. Quite misleading though, because when you get the subdomain via API, it gives you just 13cptesttld.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,418
1,001
313
cPanel Access Level
Root Administrator
I'm always happy to poke our team to see if we can make the docs more clear. Was there a certain page you were following along with? Here's the API I'd recommend using for this work:


as the API2 tools are mostly deprecated.