API Stabel?

Discussion in 'General' started by telvenes, Oct 24, 2016.

  1. telvenes

    telvenes Member

    Hi, Wonder if the API of ISPConfig is stable?
    Planning and creating a little simpler interface for creating pages mail and ftp to ispconfig.
    You recommend us and use it?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The API is stable since many years now, we use it e.g. in the migration tool and other tools like the WHMCS or Roundcube plugin use it as well.
     
  3. telvenes

    telvenes Member

    any other projects i can download for lookig at som code to get myself satarted more easy?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    See api exmples and documentation in the remote_client directory of the ispconfig tar.gz.
     
  5. telvenes

    telvenes Member

    I have created a remote user and this give "SOAP Error: Bad Request"
    PHP:
    <?php

    $username 
    'admin';
    $password 'mypassword';

    $soap_location 'http://localhost:8080/remote/index.php';
    $soap_uri 'http://localhost:8080/remote/';


    $client = new SoapClient(null, array('location' => $soap_location,
            
    'uri'      => $soap_uri,
            
    'trace' => 1,
            
    'exceptions' => 1));


    try {
        
    $session_id $client->login($username$password);
        echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
        echo 
    "Logging out: ";
        
    $client->logout($session_id);
        echo 
    "Logged out.";


    }catch (
    SoapFault $e) {
        echo 
    $client->__getLastResponse();
        die(
    'SOAP Error: '.$e->getMessage());
    }

    ?>
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Are you sure that your ispconfig interface is not https?
     
  7. telvenes

    telvenes Member

    OBS, this gives me : SOAP Error: Could not connect to host
    PHP:
    <?php

    $username 
    'api';
    $password 'PW';

    $soap_location 'https://localhost:8080/remote/index.php';
    $soap_uri 'https://localhost:8080/remote/';


    $client = new SoapClient(null, array('location' => $soap_location,
            
    'uri'      => $soap_uri,
            
    'trace' => 1,
            
    'exceptions' => 1));


    try {
        
    $session_id $client->login($username$password);
        echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
        echo 
    "Logging out: ";
        
    $client->logout($session_id);
        echo 
    "Logged out.";


    }catch (
    SoapFault $e) {
        echo 
    $client->__getLastResponse();
        die(
    'SOAP Error: '.$e->getMessage());
    }

    ?>
     
  8. telvenes

    telvenes Member

    now it works.
    PHP:
    <?php

    $username 
    'test';
    $password 'test';

    $soap_location 'https://isp1:8080/remote/index.php';
    $soap_uri 'https://isp1:8080/remote/';



    $client = new SoapClient(null, array('location' => $soap_location,
    'uri' => $soap_uri,
    'trace' => 1,
    'stream_context'=> stream_context_create(array('ssl'=> array('verify_peer'=>false,'verify_peer_name'=>false)))
    ));


    try {
            
    $session_id $client->login($username$password);
            echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
            echo 
    "Logging out: ";
            
    $client->logout($session_id);
            echo 
    "Logged out.";


    }catch (
    SoapFault $e) {
            echo 
    $client->__getLastResponse();
            die(
    'SOAP Error: '.$e->getMessage());
    }

    ?>
     
  9. telvenes

    telvenes Member

    where can i set default php version in the api? and also can i set stats password from the api?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    you can use all variables in $params array that exist as fields in the database.
     

Share This Page