Best way to get all domain names under a reseller account.

gunsuka

Member
Jan 18, 2015
10
0
1
cPanel Access Level
Root Administrator
I am using a reseller account to query cPanel's WHM API.

My objective is to get all domains under the reseller.

Here is my process.

1) Authenticate to WHM API
2) Execute WHM API's listaccs which gives me accounts under the reseller
3) Loop over every account returned from listaccs one by one
4) Execute several cPanel API 2 commands to built up a list of domains. So far I am executing DomainLookup:getbasedomains and AddonDomain:listaddondomains

If a reseller has 500 accounts under it, I can end up doing a log of API calls to collect all the data I need.

Am I going about this the best way? Is there any command that I've missed that can get me what I am after, or chain together some API calls or something?
 

DavidN.

Active Member
Mar 19, 2013
42
3
83
cPanel Access Level
DataCenter Provider
Hello,

Thanks for contacting us. I've been looking through our SDK documentation, and using the API, I can't think of a better way to do this than you're already doing.

It's currently possible to get this information directly off disk. The files in /var/cpanel/users are named for each user, and each file lists the user's owner and all of their domain names, as well as a bunch of other useful information. The format of these files could change in the future, so using the API might be a safer alternative.

David Nielson
cPanel Developer
 

gunsuka

Member
Jan 18, 2015
10
0
1
cPanel Access Level
Root Administrator
Thanks David, just wanted to make sure there was not a better way.

We are developing a service for cPanel resellers, so we do not have direct access to the servers. What we are doing is working, just a lot of API calls but it does get the job done.