REST API - client id

Discussion in 'Developers' Forum' started by craigfanman, Oct 19, 2016.

  1. craigfanman

    craigfanman Member

    Hi. I'm trying to migrate some code from the old soap api to the new rest api. I have a chunk of code that does this:

    create client
    create site
    create ftp
    create db user
    create db

    this all works fine up until create db user, I am trying to send the client ID to associate with it, but the db user account gets created in ispconfig with no client. Heres my old code that worked properly:


    PHP:
    $site_result $this->api_request("sites_database_user_add",
                array(
                        
    $this->session_id,
                        
    $clientId,
                        array(
                                
    'server_id' => $serverId,
                                
    'database_user' => $dbUser,
                                
    'database_password' => $dbPass

                            
    )
                    )
                );
    And my new code (using guzzle in laravel)



    PHP:
      $dbUser $gclient->request('POST'$ispUrl.'sites_database_user_add', [
            
    'json' => [
              
    'session_id' => $session_id,
              
    'client_id' => $clientId,
              
    'params' => [
                  
    'server_id' => $server_id,
                  
    'database_user' => $dbUsername,
                  
    'database_password' => $dbPassword
              
    ]
            ]
          ]);
    I've tried a few things putting client_id in params etc but it seems like I'm not sending the client_id in the correct way, has anyone got any ideas to solve this? Thanks
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    maumar likes this.

Share This Page