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.

How to get the main domain through the cPanel API

Discussion in 'cPanel Developers' started by mberchtold, Apr 2, 2009.

  1. mberchtold

    mberchtold Member

    Joined:
    Oct 2, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello ...

    I did not figure out how to get the main domain of the cPanel user through the API. Is this possible?

    Thank you
    Regards
    Mat
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Yes, here is the API1 call:

    Code:
    <cpanel print="$CPDATA{'DNS'}">
     
  3. mberchtold

    mberchtold Member

    Joined:
    Oct 2, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Thank you.

    And what's the URL to access the API1? And what method do I need to use to pass the command string? POST or GET?

    Regards,
    Mat
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  5. mberchtold

    mberchtold Member

    Joined:
    Oct 2, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I have previously looked at the documentation and the PHP class but there was nothing specific about the API1 print function. Hence my request. In the meanwhile with a bit of trial and error I figured it out:

    API1:
    <cpanel print="$CPDATA{'DNS'}">
    translates to:
    http://host:2082/xml-api/cpanel?xmlin=<cpanelaction><module>print</module><func>$CPDATA{'DNS'}</func><apiversion>1</apiversion></cpanelaction>

    API1
    <cpanel print="DOMAIN">
    translates to:
    http://host:2082/xml-api/cpanel?xmlin=<cpanelaction><module>print</module><func>DOMAIN</func><apiversion>1</apiversion></cpanelaction>
     
Loading...

Share This Page