• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Migration using RPC API

MerlijnH

Basic Pleskian
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):

<packet version="1.6.0.2">
<migration>
<start>
<host>87.250.xxx.xxx</host>
<login>root</login>
<password>xxxxxxxxxxxxxxx</password>
<destination-host-directory>/home/migration</destination-host-directory>
<system-type>unix</system-type>
<selected-objects>
<migrate-clients>
<target-owner>admin</target-owner>
<client>
<name>someclientlogin</name>
<ip>
<old>
<ip-type>shared</ip-type>
<ip-address>87.250.xxx.xxx</ip-address>
</old>
<new>
<ip-type>shared</ip-type>
<ip-address>87.250.xxx.xxx</ip-address>
</new>
</ip>
<domain>
<name>somedomain.nl</name>
<ip>
<old>
<ip-type>shared</ip-type>
<ip-address>87.250.xxx.xxx</ip-address>
</old>
<new>
<ip-type>shared</ip-type>
<ip-address>87.250.xxx.xxx</ip-address>
</new>
</ip>
</domain>
</client>
</migrate-clients>
</selected-objects>
</start>
</migration>
</packet>

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:

<?xml version="1.0"?>
<packet version="1.6.0.2">
<system>
<status>error</status>
<errcode>1029</errcode>
<errtext>Authentification method is not specified</errtext>
</system> </packet>

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.
 
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
# cat request.xml| ./script.pl IP_address admin's_password

It should work.
 
Back
Top