1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Migration using RPC API

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by MerlijnH, Jan 12, 2011.

  1. MerlijnH

    MerlijnH Basic Pleskian

    17
    35%
    Joined:
    Sep 30, 2010
    Messages:
    27
    Likes Received:
    0
    To start off, I have confirmed several times that migrating manually (using the web interface) works fine for the client/domain I am trying to migrate. However as I now want to automate the process I have been coding against the XML API to start the migration. I have basically generated a packet much like the Request samples and here's what I am sending (anonimized):

    In this case the destination server is running Plesk 9.5.4 on Ubuntu and the source server is Plesk 8 on FreeBSD. The response the destination server gives is:

    I have extensively looked at the documentation and example, and obviously googled the error code/message. I cannot seem to find any options that would allow me to set any method of authentication.

    Is anyone able to shed some light on what I am missing here?

    Thank you.
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Yes, there is problem with authentication on 8.x Plesk version. I can suggest you to use following tested perl script for your API XML requests:

    Code:
    #!/usr/bin/perl 
     
    use strict; 
    use warnings; 
     
    use Crypt::SSLeay;
    use LWP::UserAgent;
     
    use constant HOST => $ARGV[0]; 
    use constant PORT => 8443; 
    use constant PATH => "/enterprise/control/agent.php"; 
    use constant LOGIN => "admin"; 
    use constant PASSWD => $ARGV[1]; 
     
    my $content = ''; 
    while (<STDIN>) { 
    $content .= $_ 
    } 
     
    my $userAgent = new LWP::UserAgent;
    my $request = new HTTP::Request('POST' => 'https://' . HOST . ':' . PORT . PATH);
    $request->content_type('text/xml');
    $request->header(':HTTP_AUTH_LOGIN' => LOGIN);
    $request->header(':HTTP_AUTH_PASSWD' => PASSWD);
    $request->header(':HTTP_PRETTY_PRINT' => "TRUE");
    $request->content($content);
    
    my $response = $userAgent->request($request);
    print $response->content(); 
    You can use it with
    It should work.
     
Loading...