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.

Calling hostname and version commands in end user account

Discussion in 'cPanel Developers' started by ck, May 11, 2010.

  1. ck

    ck Member

    Joined:
    Aug 15, 2001
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi Everybody

    I am getting a "permissions denied" error while trying to call the XML-API commands for showing hostname and cPanel/WHM version through end user or reseller accounts. It works fine when I use an admin account to call them.

    My question therefore would be, are those 2 commands (gethostname & version) supported for end users and resellers? If so, can somebody show me a sample query string?

    Thanks! :)
     
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    These functions are only supported through WHM. However the StatsBar::stat API2 call probably has what you are looking for in it.

    ApiStatsBar < ApiDocs/Api2 < TWiki

    In order to get the data that you want, you'd probably want to call this:

    /xml-api/cpanel?cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&display=hostname|cpanelrevision|cpanelversion

    Which if you look at:
    <cpanelresult><data><value> you will see that it has your version, build number and hostname divided up between the three <data> nodes.
     
  3. ck

    ck Member

    Joined:
    Aug 15, 2001
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi Matt

    Cool, that was exactly what I was looking for in fact.. and even more! :)

    Now I just need to think of some creative way to bring up server load just like how it shows up in cPanel.

    Thanks again
     
  4. ck

    ck Member

    Joined:
    Aug 15, 2001
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi Matt

    I am trying to run that api command but keep on getting a permissions denied error. Just to check, I am using a non root user with no admin or reseller privileges to run the command. Would that work? It works fine when I try running the command using root user but not with any other enduser accounts.
     
  5. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    ck,
    Are you trying to run it before logging into cPanel?

    If so, cPanel will not prompt for authentication.

    When scripting this call, you will need to send HTTP Auth data as a header in the initial request.

    If you could show me some code, that would be extremely handy :)
     
  6. ck

    ck Member

    Joined:
    Aug 15, 2001
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Its working fine now... coding error on our end as expected ;)
     
Loading...

Share This Page