• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Can't create virtual hosting for domain using API

A

ArturK

Guest
Hi there.

This page:

https://mirror.proserve.nl/plesk/Plesk/PPP9/Doc/en-US/plesk-9.2-api-rpc/index.htm?fileName=33895.htm

shows an example for creating new domain with virtual hosting for an existing user:

<packet version="1.6.0.0">
<domain>
<add>
<gen_setup>
<name>newdomain.com</name>
<owner-id>1234</owner-id>
<htype>vrt_hst</htype>
<ip_address>192.0.2.123</ip_address>
<status>0</status>
</gen_setup>
<hosting>
<vrt_hst>
<ftp_login>c4u7dwbc2y8</ftp_login>
<ftp_password>qweqwe</ftp_password>
<ip_address>192.0.2.54</ip_address>
</vrt_hst>
</hosting>
</add>
</domain>
</packet>



My client creates exactly the same request:

<packet version="1.6.0.2">
<domain>
<add>
<gen_setup>
<name>www.pornstar.es</name>
<owner-id>66</owner-id>
<status>0</status>
<ip_address>94.127.185.100</ip_address>
<htype>vrt_hst</htype>
</gen_setup>

<hosting>
<vrt_hst>
<ftp_login>artur</ftp_login>
<ftp_password>artur12345</ftp_password>
<ip_address>94.127.185.100</ip_address>
</vrt_hst>
</hosting>

</add>
</domain>
</packet>


However, I get error : 1014 Invalid request


I have also tried this: (which is done with new version of the api)

<packet version="1.6.0.2">
<domain>
<add>
<gen_setup>
<name>www.pornstar.es</name>
<owner-id>66</owner-id>
<status>0</status>
<ip_address>94.127.185.100</ip_address>
<htype>vrt_hst</htype>
</gen_setup>

<hosting>
<vrt_hst>
<property>
<name>ftp_login</name>
<value>artur</value>
</property>
<property>
<name>ftp_password</name>
<value>artur12345</value>
</property>
</vrt_hst>
</hosting>
</add>
</domain>
</packet>


No luck either. It gives me the same error.

What could possibly be wrong with it???
 
try this - this is the method I have used
it also includes a lot of stuff you arent using in your example, but you can remove what you dont want.

Code:
<packet version="1.6.0.0">
<domain>
<add>
<gen_setup>
	<name>domain-without-www.com</name>
	<owner-id>9999</owner-id>
	<ip_address>10.10.10.10</ip_address>
	<htype>vrt_hst</htype>
</gen_setup>
<hosting>
	<vrt_hst>
		<property>
			<name>ftp_login</name>
			<value>mylogin</value>
		</property>
		<property>
			<name>ftp_login</name>
			<value>mypassword</value>
		</property>
		<property>
			<name>ssl</name>
			<value>false</value>
		</property>	
		<property>
			<name>php</name>
			<value>true</value>
		</property>
		<property>
			<name>ssi</name>
			<value>true</value>
		</property>
		<property>
			<name>cgi</name>
			<value>true</value>
		</property>
		<property>
			<name>mod_perl</name>
			<value>true</value>
		</property>
		<property>
			<name>mod_python</name>
			<value>true</value>
		</property>
		<property>
			<name>asp</name>
			<value>true</value>
		</property>
		<property>
			<name>ip_address</name>
			<value>10.10.10.10</value>
		</property>
		<shell-forbidden/>
	</vrt_hst>
</hosting>
<prefs>
	<www>false</www>
	<stat_ttl>3</stat_ttl>
</prefs>
<performance>
	<bandwidth>307200</bandwidth>
	<max_connections>100</max_connections>
</performance>
</add>
</domain>
</packet>
 
Last edited:
Thanks

Thanks for the answer. I managed to sort this out just after posting this message by trying various combinations.

I have wasted a lot of time thanks to the Plesk API Reference which is a bit messy for the newcomer.

As a reference I used:
http://download1.parallels.com/Plesk/PPP9/Doc/en-US/plesk-9.5-api-rpc/


It has two examples:

<packet version="1.6.0.1">
<domain>
<add>
<gen_setup>
<name>sample.com</name>
<ip_address>192.0.2.48</ip_address>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>ftp_login</name>
<value>ftp16se4fdf0</value>
</property>
<property>
<name>ftp_password</name>
<value>qweqwe</value>
</property>
<ip_address>192.0.2.48</ip_address>
</vrt_hst>
</hosting>
</add>
</domain>
</packet>


OR


<packet version="1.6.0.0">
<domain>
<add>
<gen_setup>
<name>newdomain.com</name>
<owner-id>1234</owner-id>
<htype>vrt_hst</htype>
<ip_address>192.0.2.123</ip_address>
<status>0</status>
</gen_setup>
<hosting>
<vrt_hst>
<ftp_login>c4u7dwbc2y8</ftp_login>
<ftp_password>qweqwe</ftp_password>
<ip_address>192.0.2.54</ip_address>
</vrt_hst>
</hosting>
</add>
</domain>
</packet>

The first one doesn't mention owner-id node
The second one simply doesn't work.
And the mix of two does.
 
Yeah I have found the parallels documentation to be quite bad, especially when it comes to code samples. It has gotten better over the years but obviously its not perfect by any means, no documenation ever really is.

The best part is the engrish, you kind of shake your head reading these things sometimes wondering if their primary audience is really english speaking people, then why they didnt do a better job of translating :)
 
Back
Top