Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 14 of 14
  1. #1
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default cpanel api from WHM

    Hi

    I think we can call cpanel api through whm right?
    CallingAPIFunctions < AllDocumentation/AutomationIntegration < TWiki

    says that :Under certain circumstances, you may need to use the XML or JSON API as a "wrapper" to access the functions performed by API version 1 or version 2. You can do this from within either WebHost Manager or cPanel.

    This is what I did:
    in whm i hit :
    domain.com:2086/xml-api/cpanel?cpanel_xmlapi_user=root&cpanel_xmlapi_module=Email&cpanel_xmlapi_func=listpopswithdisk%20&cpanel_xmlapi_version=2&domain=somedomain.com

    and I got following result:
    <cpanelresult>
    <apiversion>2</apiversion>
    <func>listpopswithdisk </func>
    <module>Email</module>
    </cpanelresult>

    Did I go wrong somewhere? I need to be able to call Cpanel Api functions without logging in to respective cPanel but from WHM itself.

    HELP!!
    Last edited by broncha; 07-15-2009 at 07:48 PM.

  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 broncha View Post
    Hi

    I think we can call cpanel api through whm right?
    CallingAPIFunctions < AllDocumentation/AutomationIntegration < TWiki

    says that :Under certain circumstances, you may need to use the XML or JSON API as a "wrapper" to access the functions performed by API version 1 or version 2. You can do this from within either WebHost Manager or cPanel.

    This is what I did:
    in whm i hit :
    domain.com:2086/xml-api/cpanel?cpanel_xmlapi_user=root&cpanel_xmlapi_module=Email&cpanel_xmlapi_func=listpopswithdisk%20&cpanel_xmlapi_version=2&domain=somedomain.com

    and I got following result:
    <cpanelresult>
    <apiversion>2</apiversion>
    <func>listpopswithdisk </func>
    <module>Email</module>
    </cpanelresult>

    Did I go wrong somewhere? I need to be able to call Cpanel Api functions without logging in to respective cPanel but from WHM itself.

    HELP!!
    The cpanel_xmlapi_user parameter indicates which cPanel account to execute this API2 function as. You should put the cPanel user's username here, not root.

  3. #3
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hi

    I changed the username but the same result again..Can this be the problem in the cpanel itself?? coz I get this working :

    domain.com:2086/xml-api/cpanel?cpanel_xmlapi_user=username&cpanel_xmlapi_module=Rand&cpanel_xmlapi_func=getranddata&cpa nel_xmlapi_version=2&domain=somedomain.com

    This works for me...Why not other modules and functions??

  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 broncha View Post
    Hi

    I changed the username but the same result again..Can this be the problem in the cpanel itself?? coz I get this working :

    domain.com:2086/xml-api/cpanel?cpanel_xmlapi_user=username&cpanel_xmlapi_module=Rand&cpanel_xmlapi_func=getranddata&cpa nel_xmlapi_version=2&domain=somedomain.com

    This works for me...Why not other modules and functions??
    Can you perform the function you are requesting via the APIs in cPanel? If yes, then it is not a cPanel issue.

    Are you still trying to do Email::listpopswithdisk like you were before? Be sure to trim the trailing space from listpopswithdisk if you are using the code you pasted earlier.

    If that doesn't work, please let me know what you are experiencing (error message, login screen etc.).

  5. #5
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hi

    I tried the same with cPanel :

    somedomain.com:2082/xml-api/cpanel?cpanel_xmlapi_user=username&cpanel_xmlapi_modul e=Email&cpanel_xmlapi_func=listpopswithdisk&cpanel_xmlapi_version=2&domain=somedomain.com

    The result is:
    <cpanelresult>
    <apiversion>1</apiversion>
    <type>text</type>

    <data>
    <result>0</result>
    <reason>No Valid Command Given.</reason>
    </data>
    </cpanelresult>

    check these:
    <apiversion>1</apiversion>
    This makes me think mine is not supporting API2 or what?? I've used cpanel_xmlapi_version=2 in the command!!

  6. #6
    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 broncha View Post
    ...
    <cpanelresult>
    <apiversion>1</apiversion>
    <type>text</type>

    <data>
    <result>0</result>
    <reason>No Valid Command Given.</reason>
    </data>
    </cpanelresult>
    ..
    This can happen if you have spaces in your URL. Please remove all spaces.

  7. #7
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Thanks for that quick response.
    I got it working in cPanel but still not in WHM.
    Any idea why??
    I copied and pasted the same command..which worked from cPanel

  8. #8
    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 broncha View Post
    Thanks for that quick response.
    I got it working in cPanel but still not in WHM.
    Any idea why??
    I copied and pasted the same command..which worked from cPanel
    Maybe it's the username parameter?

    In cPanel, the username parameter is essentially ignored since you only have access to 1 account so the APIs assume you're performing the task on the only account you have access to.

    In WHM, the username parameter is important since as a reseller or root user you can have access to many accounts. Be sure to specify the username parameter correctly and remember that it is case-sensitive.

    If you insert a username that is wrong, the API call can still work in cPanel. However since this is important in WHM, it will cause the API call to malfunction in WHM.

  9. #9
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hi I double checked it. Everything is correct..just not working for some reason...And I can't figure out why???

  10. #10
    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 broncha View Post
    Hi I double checked it. Everything is correct..just not working for some reason...And I can't figure out why???
    Drop me an email to sales@cpanel.net with ATTN: DavidG in the subject line so you and I can work on this in private.

  11. #11
    Registered User
    Join Date
    Jul 2009
    Posts
    2

    Default cPanel API

    I'm getting the same thing when I try it. No spaces, and the syntax seems to be correct.

  12. #12
    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 jlone View Post
    I'm getting the same thing when I try it. No spaces, and the syntax seems to be correct.
    Please provide your full cPanel version information as well as the API URL you are sending to WHM or cPanel. This will allow me to assist you.

  13. #13
    Member broncha's Avatar
    Join Date
    Feb 2009
    Location
    Kathmandu,Nepal
    Posts
    32
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hehe Documentation glitch . The fast mode takes only 'user' as parameter and not 'cpanel_xmlapi_user'

    The documentation has already been updated.
    Thanks Matt.

  14. #14
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    broncha, that's not entire correctly, but that is the jist of the issue.

    In some cases cpanel_xmlapi_user does not work - it appears to be an issue with the 11.24.4 version (while it seems to work on 11.24.7+ )
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

Similar Threads & Tags
Similar threads

  1. WHM / cPanel API
    By paulipv in forum cPanel Developers
    Replies: 9
    Last Post: 07-09-2009, 02:30 PM
  2. cPanel/WHM API?
    By hb-travisbell in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-26-2006, 05:42 PM
  3. cPanel / WHM API for PHP5
    By Spiral in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 10-18-2006, 01:54 PM
  4. cPanel/WHM API help
    By webadpro in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-02-2006, 02:18 PM
  5. Cpanel/Whm API
    By farshad_s3 in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 09-17-2004, 12:14 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube