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.

XML API: always get login screen, not XML

Discussion in 'cPanel Developers' started by sldff3ald, Sep 17, 2007.

  1. sldff3ald

    sldff3ald Registered

    Joined:
    Sep 16, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    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:

    http://forums.cpanel.net/showthread.php?t=70555
    http://forums.cpanel.net/showthread.php?t=70344
    http://forums.cpanel.net/showthread.php?t=71146
     
  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
    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?
     
    #2 cPanelDavidG, Sep 18, 2007
    Last edited: Sep 18, 2007
  3. sldff3ald

    sldff3ald Registered

    Joined:
    Sep 16, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  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
    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/xml-api/listaccts?searchtype=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.
     
Loading...

Share This Page