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.

listdbs api succeed with no data.

Discussion in 'General Discussion' started by Spyros, Nov 11, 2014.

  1. Spyros

    Spyros Member

    Joined:
    Jul 1, 2014
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Athens, Greece, Greece
    cPanel Access Level:
    Root Administrator
    Hi,

    I use api calls to list databases of accounts. the listdbs call working for all cpanel account without problem except one account., in this account give me succesfull message(result => 1) but with null in data.( no databases inside). the account (wideserv) has databases(over 20).

    my code

    PHP:
    $ip "148.251.XXX.XXX"//change it for security resons
    $root_pass="xxxxxxxxxx"//same
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root"$root_pass);
    $xmlapi->set_debug(1);
    $xmlapi->set_output('array');
    $db $xmlapi->api1_query($_SESSION["domain"], "Mysql""listdbs");                           
    if i set $_SESSION["domain"]="widetesting" or whatever domain of our server we take back the listdbs result

    Code:
      GNU nano 2.0.9                                 File: out.txt                                                                        
    
       array(7) {
      ["module"]=>
      string(5) "Mysql"
      ["func"]=>
      string(7) "listdbs"
      ["type"]=>
      string(5) "event"
      ["source"]=>
      string(8) "internal"
      ["apiversion"]=>
      string(1) "1"
      ["data"]=>
      array(1) {
        ["result"]=>
        string(5952) "<b>widetest_XXXXXXXXX</b>    //changed for security reasons
      }
      ["event"]=>
      array(1) {
        ["result"]=>
        string(1) "1"
      }
    }
    
    
    lets set now $_SESSION["domain"]="wideserv" . the account with the listing problem.

    result
    Code:
       array(7) {
      ["module"]=>
      string(5) "Mysql"
      ["func"]=>
      string(7) "listdbs"
      ["type"]=>
      string(5) "event"
      ["source"]=>
      string(8) "internal"
      ["apiversion"]=>
      string(1) "1"
      ["data"]=>
      array(1) {
        [0]=>
        array(0) {
        }
      }
      ["event"]=>
      array(1) {
        ["result"]=>
        string(1) "1"
      }
    }
    
    

    The query not failing but not give me the result of this, and only this account.

    if i change $_SESSION["domain"] to an account name that not exist, lets say "mpampatsa" it will give me an error

    Code:
       array(2) {
      ["error"]=>
      string(45) "User parameter is invalid or was not supplied"
      ["data"]=>
      array(2) {
        ["result"]=>
        string(1) "0"
        ["reason"]=>
        string(45) "User parameter is invalid or was not supplied"
      }
    }
    
    



    Thx for your time.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page