Results 1 to 2 of 2

Thread: XML API class works with a WHM cPanel reseller account?

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    1

    Default XML API class works with a WHM cPanel reseller account?

    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 Code:
    $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 Code:
    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. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default 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*)

    VPS Server or Dedicated Server
    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
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

Similar Threads

  1. XML API PHP Class version 1.0
    By MattDees in forum cPanel Developers
    Replies: 107
    Last Post: 02-24-2011, 08:38 AM
  2. Install wildcard ssl using XML API class
    By tomdchi in forum cPanel Developers
    Replies: 4
    Last Post: 02-21-2010, 07:58 PM
  3. WHM XML API ready to use class
    By arash_hemmat in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 07-18-2008, 05:03 AM
  4. XML-API, Setup reseller + Account Creation Limits
    By jprl12 in forum cPanel Developers
    Replies: 1
    Last Post: 03-03-2008, 10:42 AM

Tags for this Thread