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.

XML-API 1.0 beta

Discussion in 'cPanel Developers' started by paulipv, Jul 9, 2009.

  1. paulipv

    paulipv Member

    Joined:
    Jul 2, 2009
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    We have finished a beta that including the Accounting actions.

    We have attached the code for testing.

    Available functions:

    1. createacct($array) -> create new account (see examples.php for a demo).
    2. accountsummary($user) -> return account details
    3. modifyacctdomain($user , $newdomain , $currentdomain=optional) modify the username primary domain
    4. modifyacctuser($current_user , $new_user) -> changing the current username

    5. editquota($user , $newquota) -> modify user quota
    6. changepw($user , $pass=optional) -> change user password (if you dont set the pass, a new password 8char will be generated.

    7. suspendacct($user , $reason) -> suspend an account
    8. unsuspendacct($user) -> unsuspend account
    9. removeacct($user , $keepdns) -> remove an account
    10. listacct() -> list all server accounts
    11. searchacct($search, $searchtype) -> allowed search types, domain,owner, user, ip, package.

    12. changeacctpackage($user,$newpackage) -> not working at the moment.

    so please ask if you dont understand something.
    have any idea? just say it and if its ok we will implement it.

    @see examples.php for a account creation demo.


    Every function will return an array which looks like:

    PHP:

      
    // Example of change account password.
     
    $result $instanceofclass->accounting()->changepw('myuser','mypass');

     if (
    $result['status'] == 1) {
     echo 
    'Password succesfully changed';
     echo 
    'New pass '.$result['set']['pass'].' ';
     
    }



    Array
    (
        [
    obj] => changepw
        
    [server] => 1.1.1.1
        
    [time] => 1247156381
        
    [date] => 2009-07-09 19:19:41
        
    [remote_addr] => 192.168.0.1
        
    [set] => Array
            (
                [
    username] => myuser
                
    [pass] => mypass
            
    )

        [
    get] => Array
            (
                [
    rawout] => Changing password for myuser Password for myuser has been changed Updating ftp passwords for myuser Ftp password files updatedFtp vhost passwords synced

                
    [app] => postgresql
                
    [services] => 
                [
    status] => 1
                
    [statusmsg] => Password changed for user myuser
            
    )

        [
    status] => 1
        
    [statusmsg] => Password changed for user myuser
    )



    listacct() returns something like this:

    access a user from list simple
    $result['get']['username']


    PHP:
    Array
    (
        [
    status] => 1
        
    [statusmsg] => Ok
        
    [obj] => getacctlist
        
    [server] => central.ipvhost.ro
        
    [time] => 1247157066
        
    [date] => 2009-07-09 19:31:06
        
    [remote_addr] => 192.168.0.1
        
    [get] => Array
            (
                [
    myuser] => Array
                    (
                        [
    disklimit] => unlimited
                        
    [diskused] => 0M
                        
    [domain] => mydomainblog.com
                        
    [email] => myname@myemail.com
                        
    [ip] => 1.1.1.1
                        
    [maxaddons] => unlimited
                        
    [maxftp] => unlimited
                        
    [maxlst] => unlimited
                        
    [maxparked] => unlimited
                        
    [maxpop] => unlimited
                        
    [maxsql] => unlimited
                        
    [maxsub] => unlimited
                        
    [owner] => root
                        
    [partition] => home
                        
    [plan] => WHM-IPV
                        
    [startdate] => 09 Jul 09 19:01
                        
    [suspended] => 0
                        
    [suspendreason] => not suspended
                        
    [suspendtime] => 
                        [
    theme] => x3
                        
    [unix_startdate] => 1247155314
                        
    [user] => myuser
                        
    [acct] => 
                    )

                [
    myuser1] => Array
                    (
                        [
    disklimit] => unlimited
                        
    [diskused] => 0M
                        
    [domain] => mydomainblog.com
                        
    [email] => myname@myemail.com
                        
    [ip] => 1.1.1.1
                        
    [maxaddons] => unlimited
                        
    [maxftp] => unlimited
                        
    [maxlst] => unlimited
                        
    [maxparked] => unlimited
                        
    [maxpop] => unlimited
                        
    [maxsql] => unlimited
                        
    [maxsub] => unlimited
                        
    [owner] => root
                        
    [partition] => home
                        
    [plan] => WHM-IPV
                        
    [startdate] => 09 Jul 09 19:01
                        
    [suspended] => 0
                        
    [suspendreason] => not suspended
                        
    [suspendtime] => 
                        [
    theme] => x3
                        
    [unix_startdate] => 1247155314
                        
    [user] => myuser1
                        
    [acct] => 
                    )

            )

    )


     

    Attached Files:

    • WHM.zip
      File size:
      5.8 KB
      Views:
      13
Loading...

Share This Page