Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Oct 2003
    Posts
    11

    Default How to get the main domain through the cPanel API

    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. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by mberchtold View Post
    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
    Yes, here is the API1 call:

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

  3. #3
    Member
    Join Date
    Oct 2003
    Posts
    11

    Default

    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. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by mberchtold View Post
    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
    We have a PHP class you can use to interact with API1 via the XML API: http://forums.cpanel.net/showthread.php?t=111897

    Otherwise, you can read the documentation on how to do this yourself at http://www.cPanel.net/plugins/xmlapi

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    11

    Default

    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>

Similar Threads & Tags
Similar threads

  1. How to replace Main domain in Cpanel?
    By sckchris in forum New User Questions
    Replies: 6
    Last Post: 07-27-2011, 09:48 PM
  2. Replies: 2
    Last Post: 05-04-2011, 10:54 AM
  3. Changing main ftp password through api
    By Irritum in forum cPanel Developers
    Replies: 6
    Last Post: 02-24-2011, 09:36 AM
  4. XML API - Change Main Domain Name?
    By SomeoneX in forum cPanel Developers
    Replies: 2
    Last Post: 09-05-2009, 12:35 AM
  5. Can I use cPanel for the server's main domain?
    By sneader in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-20-2003, 11:55 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube