#1 (permalink)  
Old 07-15-2009, 08:39 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
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_modul e=Email&cpanel_xmlapi_func=listpopswithdisk%20&cpa nel_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 08:48 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-16-2009, 11:18 AM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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_modul e=Email&cpanel_xmlapi_func=listpopswithdisk%20&cpa nel_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.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-16-2009, 01:46 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
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_m odule=Rand&cpanel_xmlapi_func=getranddata&cpa nel_xmlapi_version=2&domain=somedomain.com

This works for me...Why not other modules and functions??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-16-2009, 02:48 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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_m odule=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.).
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-16-2009, 05:04 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
Hi

I tried the same with cPanel :

somedomain.com:2082/xml-api/cpanel?cpanel_xmlapi_user=username&cpanel_xmlapi_m odul 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:
Quote:
<apiversion>1</apiversion>
This makes me think mine is not supporting API2 or what?? I've used cpanel_xmlapi_version=2 in the command!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-16-2009, 05:25 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-16-2009, 05:45 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-17-2009, 10:48 AM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-17-2009, 12:57 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
Hi I double checked it. Everything is correct..just not working for some reason...And I can't figure out why???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-17-2009, 01:04 PM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 07-18-2009, 04:25 PM
Registered User
 
Join Date: Jul 2009
Posts: 1
jlone is on a distinguished road
cPanel API

I'm getting the same thing when I try it. No spaces, and the syntax seems to be correct.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-20-2009, 11:20 AM
cPanelDavidG's Avatar
cPanel Technical Sales
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 7,995
cPanelDavidG is on a distinguished road
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.
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 07-20-2009, 03:54 PM
broncha's Avatar
Registered User
 
Join Date: Feb 2009
Posts: 14
broncha is on a distinguished road
Hehe Documentation glitch . The fast mode takes only 'user' as parameter and not 'cpanel_xmlapi_user'

The documentation has already been updated.
Thanks Matt.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 07-20-2009, 04:59 PM
Staff
 
Join Date: Apr 2005
Location: Houston, TX
Posts: 137
cPanelMatt is on a distinguished road
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
cPanel, Inc.
cPanel Integration Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WHM / cPanel API paulipv Developer Discussions 9 07-09-2009 03:30 PM
cPanel/WHM API? hb-travisbell cPanel and WHM Discussions 2 11-26-2006 06:42 PM
cPanel/WHM API help webadpro cPanel and WHM Discussions 5 03-02-2006 03:18 PM
CpanelAppz.com WHM/cpanel API anand Developer Discussions 27 02-10-2005 09:13 AM
Cpanel/Whm API farshad_s3 cPanel and WHM Discussions 17 09-17-2004 01:14 PM


All times are GMT -5. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc