Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Dec 2007
    Location
    Marília, SP, Brazil
    Posts
    18

    Default xml-api reseller

    Hi,

    I'm using the cpanel xml-api and i need to suspend some reseller accounts and i want to know if this s right because don't have xml-api command to suspend a reseller:

    - get the reseller account
    - get total of clients of the reseller
    - do a loop using total of clientes and get the clients user
    - suspend an account using the xml-api

    for example:

    $status = whmResellerStats($reg['servidor_ip'], $reg['whm_login'], $reg3['whm_key'], $reg3['dominio_login']);

    /* Total Clientes */

    $total = sizeof($status['resellerstats']['result'][0]['accts']);

    /* Percorre o vetor buscando todos os login da revenda */

    for($w = 0;$w < $total; $w++)
    {
    /* pega o login do dominio */

    $login = $status['resellerstats']['result'][0]['accts'][$w]['user'];

    /* Com o login, eh feita a suspensao */

    $susp = whmSuspendAccount($reg3['servidor_ip'], $reg3['servidor_whm_login'], $reg3['servidor_whm_key'], $login, $motivo);

    /* Verifica se a suspensao deu certo */
    if($susp['suspendacct']['result'][0]['status'] == 1)
    {
    $retorno[$i]['suspendido'] = 'Y';
    } else {
    $retorno[$i]['suspendido'] = 'Erro';
    }
    }


    []´z

  2. #2
    Member
    Join Date
    Dec 2001
    Posts
    746

    Default

    Without seeing all the code as to what functions you're calling I cant say if it's right but the logic is correct.

    I would first call this to get all the reseller's accounts:

    Code:
    /xml-api/listaccts?searchtype=owner&search=$resellerusername

    Then from that data, you have the username of each account owned by the reseller.

    You can then loop through all the usernames (mid you I'm a perl guy):

    Code:
    foreach my $username (%usernames){       
    /xml-api/suspendacct?user=$username&reason=customer%20of%20$resellerusername
    }

    Noting that I haven't specified how to call the XML API above. I usually do it with Net::SSLeay on Perl.

Similar Threads & Tags
Similar threads

  1. XML-API request: APIs for better reseller IP address management
    By jfillmore in forum Feature Requests for cPanel/WHM
    Replies: 2
    Last Post: 10-15-2009, 10:01 AM
  2. xml api on a reseller account return empty string
    By gogume in forum cPanel Developers
    Replies: 4
    Last Post: 05-22-2009, 10:00 AM
  3. /xml-api/resellerstats?reseller=root
    By SunShellNET in forum cPanel Developers
    Replies: 1
    Last Post: 04-01-2009, 10:38 AM
  4. xml-api - Reseller
    By eugui in forum cPanel Developers
    Replies: 2
    Last Post: 03-28-2008, 07:02 AM
  5. XML-API, Setup reseller + Account Creation Limits
    By jprl12 in forum cPanel Developers
    Replies: 1
    Last Post: 03-03-2008, 10:42 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube