Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

XML API class works with a WHM cPanel reseller account?

Discussion in 'cPanel Developers' started by bcosmo, Mar 16, 2010.

  1. bcosmo

    bcosmo Registered

    Joined:
    Mar 16, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    Hello my friends!

    I'm try to use the XML API class 1.0 to create accounts at my WHM cPanel reseller account. (createacct_example.php).

    PHP:
    $ip "www.domain.com";
    $root_pass "pass";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("domain",$root_pass);

    $xmlapi->set_debug(1);

    $acct = array( plan => "plan_plus"username => "band"password => "test123"domain => "band.domain.com"contactemail => "email@domain.com");
    print 
    $xmlapi->createacct($acct);
    But nothing happens, return a blank screen! maybe because my account is a Reseller type not a VPS Server or Dedicated Server.

    Other example (api2_example.php)

    PHP:
    include("xmlapi.php");

    $ip "www.domain.com";
    $root_pass "pass";

    $account "subdomain.domain.com";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("domain",$root_pass);
    $xmlapi->set_output("json");

    $xmlapi->set_debug(1);

    print 
    $xmlapi->api2_query($account"Email""listpopswithdisk" );
    Return nothing:

    Code:
    {"data":{"reason":"Access denied","result":"0"},"type":"text"} 
    My Cpanel WHM version is:

    cPanel 11.25.0-S43473 - WHM 11.25.0 - X 3.9
    CENTOS 5.4 i686 virtuozzo on sv1021

    Thanks!
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    3
    Trophy Points:
    68
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    xml-api with reseller credentials

    Hi bcosmo,

    First issue:

    If your Reseller account has been given permission to create accounts, then the xmlapi call should work. Have you tried it without specifying a plan/package? Your reseller account many be restricted on packages too. I'm really surprised you got ..nothing... You should have, at minimum a pair of curly braces and an empty data key (for JSON) or an empty root node (for XML).

    Have you tried the same call, but specifying xml output instead?
    Code:
    $xmlapi->set_output('xml');
    
    I know that's not what you desire, but it should return the same response, only formatted differently. If it doesn't it could be a tell-tale sign of a bug (though I just tried in on working servers *shrug*)

    I don't see any reason that hardware allocation would have any bearing on you Reseller access. Some hosting software, for their corresponding user type, is affected by this; to my knowledge cPanel/WHM is not affected by hardware allocation (for the purposes of this conversation, ie account privileges).

    Second issue:

    I'm not sure, I fully understand what you're trying to accomplish.

    My assumption is that you have 'domain.com' and 'subdomain.domain.com'; you wish to view all the emails that belong specifically to 'subdomain.domain.com'

    If that's the case, you should pass 'domain' as the cpuser and provide the "domain" variable to the api2 arguments:
    Code:
    $account = 'dave'; //this is the user for "mynameisdave.com"
    $result = $xmlapi->api2_query($account, "Email", "listpopswithdisk",
       array('domain'=>'lildave.mynameisdave.com') 
    );
    
    // Will yeild just the email addresses and disk
    //  usage for my "lildave" subdomain, ie.
    //  tiny@lildave.mynameisdave.com, but not 
    //  mr_dave@mynameisdave.com
    
    Hope this helps,
    -Dave
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice