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 output issue

Discussion in 'cPanel Developers' started by That1Swede, May 18, 2010.

  1. That1Swede

    That1Swede Member

    Joined:
    Jul 23, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Houston, Texas
    I've ran across a bit of a strange issue that I was wondering if anyone could shed any light on.

    When running the following XML API query on certain servers they return what appears to be incomplete data:

    Code:
    /xml-api/cpanel?user=test&cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&display=diskusage|addondomains|sqldatabases|emailaccounts|theme
    Normally I would expect the output to look like the following:

    Code:
    <cpanelresult>
    <apiversion>2</apiversion>
    <data>
    <name>sqldatabases</name>
    <_count>0</_count>
    <_max>unlimited</_max>
    <_maxed>1</_maxed>
    <count>0</count>
    <id>sqldatabases</id>
    <item>SQL Databases</item>
    <langkey>INDXSQLDBS</langkey>
    <max>unlimited </max>
    <percent>0</percent>
    <percent10>0</percent10>
    <percent20>0</percent20>
    <percent5>0</percent5>
    <zeroisunlimited>0</zeroisunlimited>
    </data>
    [snipped data node for each requested 'display' argument here, etc.]
    <event>
    <result>1</result>
    </event>
    <func>stat</func>
    <module>StatsBar</module>
    </cpanelresult>
    However on some servers the output returned is simply:

    Code:
    <cpanelresult>
    <apiversion>2</apiversion>
    <func>stat</func>
    <module>StatsBar</module>
    </cpanelresult>
    Note that it doesn't even contain the '<event>' node.

    The version of cPanel that was running on the server where the above output was returned on is 11.24.5-STABLE 38506 (a bit old, I know but I have no control over it).

    Now what I'm wondering is if the above is some kind of bug (known or otherwise) that's preventing the StatsBar module from returning the requested data or if the server that the request was done on may be configured in some obscure way to prevent it.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi That1Swede,

    Try adding this to your query string:
    Code:
    &cpanel_xmlapi_apiversion=2
    
    I don't know if it will solve the issue entirely, but all API1 and API2 call queries should contain the 'cpanel_xmlapi_apiversion' parameter.

    Regards,
    -David
     
    #2 cPanelDavidN, May 19, 2010
    Last edited: May 19, 2010
  3. That1Swede

    That1Swede Member

    Joined:
    Jul 23, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Houston, Texas
    Rockin'.

    That did resolve the issue. It's strange how it was only causing issues for some servers. I was expecting it to default to API2 as per the API documentation.

    You may want to update the API documentation here to reflect that it may be needed for some (I'm guessing "earlier") versions of cPanel/WHM as currently it states the following:

    Thanks for the help!
     
Loading...

Share This Page