The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'cPanel Developers' started by gunsuka, Jan 31, 2016.

  1. gunsuka

    gunsuka Member

    Joined:
    Jan 18, 2015
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    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?
     
  2. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

    Joined:
    Mar 19, 2013
    Messages:
    42
    Likes Received:
    3
    Trophy Points:
    8
    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
     
  3. gunsuka

    gunsuka Member

    Joined:
    Jan 18, 2015
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    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.
     
Loading...

Share This Page