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.

listdomains

Discussion in 'cPanel Developers' started by blargman, Nov 9, 2009.

  1. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    Is there any thought on making this function? Would be very beneficial. Currently I have no way of getting a list of subdomains or addon domains for an account through the API.


    I'm currently looking into if I can make my own api function. If someone could give me pointers on that instead that would be helpful as well

    Thoughts?
     
  2. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    so evidently this can be done through the cpanel api by specifying the username. So there's that. At any rate I've already pulled the data i needed via pyyaml from the userdata files.

    Just thought I'd update this thread in case anyone was curious in the future.
     
  3. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    There are XML-API functions for doing this:

    AddonDomainRef < DeveloperResources/ApiRef < TWiki
    SubDomainRef < DeveloperResources/ApiRef < TWiki
    ParkRef < DeveloperResources/ApiRef < TWiki

    So, for clarities sake, the easiest way to do this is (per API call) doing something like:

    Code:
    $cpanel/xml-api/cpanel?
    cpanel_xmlapi_module=AddonDomains&
    cpanel_xmlapi_func=listaddondomains
    
    which will return an XML document full of the addon domains per account.

    This can also be done through whm, however you will need to add a $user argument in order for the cpanel call to work correctly.
     
  4. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    Thanks Matt, ya that is what I was referring to as far as Cpanel API. I am new to this I didn't realize there were more functions I could access via the xml-api via xml-api/cpanel.

    Could you clarify something for me? I am going to do some more testing on it but I was under the impression I could hook into cpanel and run arbitrary commands on certain actions.

    I created /usr/local/cpanel/addondomain
    then created a file inside it /usr/local/cpanel/addondomain/deladdondomain

    It's a simple python script
    #!/usr/local/bin/python
    f=open('/root/test.txt', "w")
    f.write('This is a test\n')
    f.close

    I thought this should run any time I delete an addondomain but it doesn't appear to be. I've checked everything obvious permisisons, execute bit etc. Am I just not doing this right at all?
    I did forget to run registerhooks. I just did that though and not much more help. If I run the script manually it works fine. :\
     

Share This Page