#1 (permalink)  
Old 09-17-2007, 05:14 PM
Registered User
 
Join Date: Sep 2007
Posts: 2
sldff3ald is on a distinguished road
XML API: always get login screen, not XML

I'm trying to use the XML API with cPanel 11 (xml-api/applist). I believe I've tried every permutation of hostname/IP, port, and protocol and I either get internal server errors or a login page, but no XML. My shared host didn't have a clue. I'm trying to test this out on my shared host for deployment by someone else, but this should work if they have cPanel 11, right? Is there something my host would have to do to enable the XML API? Is there a tried-and-true way to determine the correct URL to use?

The methods I tried are the ones given here:

Creating Reseller Accounts using PHP?
WHM Interface class
cPanel URL Login
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-18-2007, 09:27 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 sldff3ald View Post
I'm trying to use the XML API with cPanel 11 (xml-api/applist). I believe I've tried every permutation of hostname/IP, port, and protocol and I either get internal server errors or a login page, but no XML. My shared host didn't have a clue. I'm trying to test this out on my shared host for deployment by someone else, but this should work if they have cPanel 11, right? Is there something my host would have to do to enable the XML API? Is there a tried-and-true way to determine the correct URL to use?

The methods I tried are the ones given here:

Creating Reseller Accounts using PHP?
WHM Interface class
cPanel URL Login
First, you must have a reseller account to use the XML-API and the server must be running cPanel 11 (not 10).

The login screen is typically the result of failed authentication. This could be anything from not encoding user/pass in the sending headers, using the improper user/pass in https://user:pass@...:2087/xml-api/applist and so forth.

Perhaps post some sample code so everyone here can analyze what may be going wrong?
__________________
Want our technical analysts to login to your server to assist you? You can contact our technical analysts at: http://tickets.cPanel.net/submit

Last edited by cPanelDavidG; 09-18-2007 at 09:27 AM. Reason: Disabled Smilies
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-19-2007, 03:12 AM
Registered User
 
Join Date: Sep 2007
Posts: 2
sldff3ald is on a distinguished road
Works now. Kinda

I've now moved the code to another server, and it sort of works. I'm using the Curl method, and /xml-api/applist, /xml-api/gethostname, and /xml-api/version all work (the last returns 11.11.0)

However, other commands simply return nothing: /xml-api/listresellers (I don't know if there are any resellers however), /xml-api/createacct, and /xml-api/listaccts.

It would be nice if the API would return some sort of error string, or if that were available somewhere.

Is there a way to turn on debugging output to either be returned as XML or to be written to a log file?

And, how do I list all the accounts using listaccts? /xml-api/listaccts?searchtype=user&search=* and with "searchtype=domain&search=*" didn't work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-19-2007, 10:29 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 sldff3ald View Post
I've now moved the code to another server, and it sort of works. I'm using the Curl method, and /xml-api/applist, /xml-api/gethostname, and /xml-api/version all work (the last returns 11.11.0)

However, other commands simply return nothing: /xml-api/listresellers (I don't know if there are any resellers however), /xml-api/createacct, and /xml-api/listaccts.

It would be nice if the API would return some sort of error string, or if that were available somewhere.

Is there a way to turn on debugging output to either be returned as XML or to be written to a log file?

And, how do I list all the accounts using listaccts? /xml-api/listaccts?searchtype=user&search=* and with "searchtype=domain&search=*" didn't work.
For a list of common issues encountered while using the XML-API and what they mean, refer to this post.

The API usually does return an error string in XML format should errors be encountered in your query. You may want to check the raw text that is being returned and compare it to the items I listed on that other post to see what may be going on.

Also, to list all users, use:

https://spacetime.cpanel.net:2087/xm...earchtype=user

Note that * is typically not used in a Unix environment in the same way as it is in a Windows environment, so * usually means the literal string * rather than a wildcard character.
__________________
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
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



All times are GMT -5. The time now is 12:34 AM.


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