To create a subdomain, use the add operation and specify a parent website name, the subdomain name and subdomain properties.
Request Packet Structure
A request XML packet adding a new subdomain to Plesk, includes the add operation node:
The add node is presented by the SubdomainAddInputType (
subdomain.xsd). Its graphical representation is as follows:
- The parent node is required. It specifies a name of site/subdomain on which a subdomain is created. (Parent subdomain is supported in Plesk for Windows only.) Data type: string.
- The name node is used and required on Windows only. It specifies a name of the subdomain. Data type: string. Use the asterisk (*) symbol to create a wildcard subdomain. Site visitors will be redirected to this subdomain regardless of the subdomain name they enter in a browser.
- The home node is used on Plesk for Windows only. It specifies a path to the subdomain's home directory relative to the parent site root directory. If the home node is left blank (
<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
Note: On Linux, you should use the
www_rootproperty (of the
propertynode) to specify the home directory for a website.
- The property node is required. It specifies a hosting setting of the created subdomain. To see the structure of this node, refer to the section Subdomain Properties. Data type: SubdomainPropertyType (
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The add node of the output XML packet is structured as follows:
- The result node is required. It wraps the response retrieved from the server. Data type: ResultType (
- The status node is required. It specifies the execution status of the add operation. Data type: result_status (
common.xsd). Allowed values:
- The errcode node is required if the add operation fails. It returns the error code. Data type: unsignedInt.
- The errtext node is required if the add operation fails. It returns the error message. Data type: string.
- The id node is required if the add operation succeeds. It returns the ID of a created subdomain. Data type: id_type (
- 1006 - Permission is denied.
- 1007 - Subdomain with such name already exists.
- 1015 - Parent site/subdomain is not found.
- 1019 - Invalid property name.
- 1023 - Operation failed.
- 1034 - Subdomains are not supported on sites without physical hosting.
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:
For more properties examples, see Changing Subdomain Settings -> Request Samples.