Need to get parent_domain via API

Operating System & Version
CentOS 7
cPanel & WHM Version
11.92.0

ArseniyS

Registered
Dec 15, 2020
1
0
1
Russia
cPanel Access Level
Root Administrator
Hello, I need to get parent domain for addon domain using cPanel/WHM API.

For example, I created an addon domain: sometestaddondomain.com and a subdomain for it: subforaddon.sometestaddondomain.com
If I call whmapi1 get_domain_info, I will get
Code:
domain: subforaddon.sometestaddondomain.com
parent_domain: account1.com
But I expect that parent_domain is sometestaddondomain.com, because I will use it to recreate subdomain via uapi in case the subdomain was removed.

On the other hand, I can get correct info from old API.
cpapi2 --user=account1 SubDomain listsubdomains
Code:
domain: subforaddon.sometestaddondomain.com
rootdomain: sometestaddondomain.com
But it might be not an option in case of space quota is reached for the account.
UAPI DomainInfo domains_data does not provide any info regarding parent domain.

Can you please give an advice how I should retrieve this info?
Thanks.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,425
696
313
cPanel Access Level
Root Administrator
Hey there! I don't think those APIs are displaying the same information. get_domain_info is showing the entire block of information about the domain, where the listsubdomains API is specifically only looking at the subdomain details. They are both working properly, but they are used in different ways to provide different information.