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.

Can not get xmlapi to work with cpanel functions.

Discussion in 'cPanel Developers' started by anton_latvia, Nov 15, 2007.

  1. anton_latvia

    anton_latvia Well-Known Member
    PartnerNOC

    Joined:
    May 11, 2004
    Messages:
    348
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    Latvia
    cPanel Access Level:
    Root Administrator
    Hello,
    I have just started to look at xml-api, as before we were succesfully using old cpanel-10 scripts. Unfortunately I am unable to get started... Most of all I would like to use cpanel-api functions. I decided to start with list of email accounts. But when I post the following string:

    /xml-api/cpanel?user=superdom
    &apiversion=2
    &xmlin=<cpanelaction><module>Email</module><func>listpopswithdisk</func><args></args></cpanelaction>

    In return I get xml:

    <?xml version="1.0" ?>
    <cpanelresult>
    <apiversion>1</apiversion>
    <type>text</type>
    <data>
    <result>Access Denied to superdom.</result>
    </data>
    </cpanelresult>

    Why is it like this? Why version is “1”? I am using latest stable build:
    WHM 11.11.0 cPanel 11.15.0-C17944
    CENTOS Enterprise 4.5 x86_64 on standard - WHM X v3.1.0

    I tried to add <domain> variable to the argument list, but that did not make any difference. For authentication I use root and remote access hash string. Also when I try to access this script in browser I get the same result.

    Small addon - I can get it working for account which is owned by root, but not for any account, owned by reseller. Why and how can I get it working for other accounts also?

    So final question is: how can I make xmlapi (particularly /cpanel script) work for reseller accounts without knowing their HASH or password?

    Regards,
    Anton.
     
    #1 anton_latvia, Nov 15, 2007
    Last edited: Nov 15, 2007
  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
    The following works for me:
    http://[B]Hostname[/B]:2086/xml-api/cpanel?user=user&apiversion=2&xmlin=<cpanelaction><module>Email</module><func>listpopswithdisk</func><args></args></cpanelaction>

    Note, you can only access users that you have privileges to access. If you are a reseller, this would only be the accounts under your reseller account. If you are root, this would be all users on the server. As for why you can't access accounts not directly owned by root, I would recommend submitting a support ticket regarding that issue so that can be properly addressed.

    Keep in mind, this error would also be generated if the user doesn't exist in the server.

    As for the version being incorrect, apiversion tends to return 1 when an error is generated (such as in your case).
     
  3. anton_latvia

    anton_latvia Well-Known Member
    PartnerNOC

    Joined:
    May 11, 2004
    Messages:
    348
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    Latvia
    cPanel Access Level:
    Root Administrator
    So if I use "root" and root's hash - I should be able to get access to all accounts, even owned by resellers? If so, I will open a ticket. Username I am trying to access exists and I can fetch list of accounts if I use reseller's login and hash string.

    Anton

    Opened new ticket: 224412
     
    #3 anton_latvia, Nov 15, 2007
    Last edited: Nov 16, 2007
  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
    That is my understanding of the APIs as they should mimic functionality and privileges of WHM.
     
Loading...

Share This Page