Creating databases/database users with the remote API

Discussion in 'Developers' Forum' started by Timmy Oblatus, Oct 9, 2014.

  1. Timmy Oblatus

    Timmy Oblatus New Member

    I've become a bit baffled by the remoting API for creating databases and database users.

    The DOC says is should use:
    PHP:
    sites_database_add($session_id$client_id$params);
    With there parameters:
    Code:
    server_id  (int(11))
    type  (varchar(16))
    database_name  (varchar(64))
    database_user  (varchar(64))
    database_password  (varchar(64))
    database_charset  (varchar(64))
    remote_access  (enum('n','y'))
    remote_ips  (text)
    active  (enum('n','y'))
    While this works, it only creates the database, and not a database user.
    I've found an un-documented function: sites_web_database_user_add() and made it work like this:
    PHP:
    $dbuser $client->sites_database_user_add
      
    $session_id0, array(
        
    "server_id" => 2,
        
    "database_user" => "mydbuser",
        
    "database_password" => "mydbpass"
      
    )
    );

    $result $client->sites_database_add(
      
    $session_id0, array(
        
    "server_id" => 2
        
    "type" => "mysql",
        
    "database_name" => "mydatabase",
        
    "database_user_id" => $dbuser,
        
    "active" => "Y"
        
    "remote_access" => "Y"
      
    )
    );
    When i look in the interface, the database and user is created.
    But if i edit the database - the user is not selected in the dropdown, and the dropdown list itself is empty.

    What is the best way to create databases and users using the remote API?

    Thanks.
     

    Attached Files:

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This has been fixed in git stable-305 branch.
     
  3. Timmy Oblatus

    Timmy Oblatus New Member

    I'm not sure how to approach this - ISPConfig was installed using the ISPConfig-3.0.5.4p4.tar file
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    ispconfig 3.0.5.4p4 has been released on october 17, it did not exist on actober 9 when you posted this. If you installed a prerelease, then update it to 3.0.5.4p4 final.
     

Share This Page