To create a subdomain, use the add operation and specify a parent website name, the subdomain name and subdomain properties.
A request XML packet adding a new subdomain to Plesk, includes the add operation node:
<packet>
<subdomain>
<add>
...
</add>
</subdomain>
</packet>
The add node is presented by the SubdomainAddInputType (subdomain.xsd
). Its graphical representation is as follows:
<home/>
), the root directory of the parent site is used. Data type: string. Another way to specify the subdomain's home directory on Windows is the www_root
property.
Note: On Linux, you should use the www_root
property (of the property
node) to specify the home directory for a website.
subdomain.xsd
).
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
The add node of the output XML packet is structured as follows:
common.xsd
).common.xsd
). Allowed values: ok|error
.common.xsd
).
Possible Errors
This packet creates subdomain sample.example.com with the home directory /sample, sets FTP account credentials, sets the SSI support, and enables using SSI for *.htm and *.html files on the subdomain:
<packet>
<subdomain>
<add>
<parent>example.com</parent>
<name>sample</name>
<property>
<name>www_root</name>
<value>/sample</value>
</property>
<property>
<name>ftp_login</name>
<value>john</value>
</property>
<property>
<name>ftp_password</name>
<value>sample</value>
</property>
<property>
<name>ssi</name>
<value>true</value>
</property>
<property>
<name>ssi_html</name>
<value>true</value>
</property>
</add>
</subdomain>
</packet>
For more properties examples, see Changing Subdomain Settings -> Request Samples.
Response:
<packet version="1.5.2.0">
<subdomain>
<add>
<result>
<status>ok</status>
<id>1</id>
</result>
</add>
</subdomain>
</packet>