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.
     
  11. Reinhold Kainhofer

    Reinhold Kainhofer New Member

    I'm using exactly the same script (with https), but the login example does not work and simply gives an error:
    Code:
    root@server ~/ispconfig3_install/remoting_client/examples # php login.php
    SOAP Error: Internal Server Error
    
    The username, password and the SOAP URLs are properly set up.

    System Info:
    - Ubuntu 16.10
    - apache 2.4.18
    - ISPConfig 3.1.1p1

    I could not find any errror or warning about this internal server error in any of the webserver's logs (). ISPConfig loglevel is set to Debug, but I still can't find anything in any of the log files in /var/log/ (not even under /var/log/ispconfig/httpd/server.domain.com/).

    Only the access.log contains the entry with the 500 return code:
    Code:
    212.183.121.55 - - [04/Dec/2016:22:39:19 +0100] "POST /remote/index.php HTTP/1.1" 500 4059 "-" "PHP-SOAP/7.0.8-0ubuntu0.16.04.3"
    
     

Share This Page