Unable to update web_database via API

Discussion in 'ISPConfig 3 Priority Support' started by variable99, May 13, 2024.

  1. variable99

    variable99 Member HowtoForge Supporter

    I have set new database quota limit in template for users. Now I need old quotas change to new values. For that I use 'sites_database_update' API call. Just like this:

    PHP:
    try {
       if(
    $session_id $client->login($username$password)) {
           echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
       }

       
    //* Parameters
       
    $database_id 1;
       
    $client_id 1;


       
    //* Get the database record
       
    $database_record $client->sites_database_get($session_id$database_id);

       
    //* Change the status to inactive
       
    $database_record['database_quota'] = 1024;

       
    $affected_rows $client->sites_database_update($session_id$client_id$database_id$database_record);

       echo 
    "Number of records that have been changed in the database: ".$affected_rows."<br>";

       if(
    $client->logout($session_id)) {
           echo 
    'Logged out.<br />';
       }


    } catch (
    SoapFault $e) {
       echo 
    $client->__getLastResponse();
       die(
    'SOAP Error: '.$e->getMessage());
    }
    The problem is, that API call gets OK, but 0 rows updated... No errors, nothing. Any clues what can be wrong?
     
  2. variable99

    variable99 Member HowtoForge Supporter

    Ha! Actually figured it out: I was passing array in array... Fixed the problem.
     
    till likes this.

Share This Page