Retrieving Information on Subdomains
The get operation is used to retrieve the following information on a subdomain from Plesk database:
- subdomain name
- parent site/subdomain name
- home directory (on Windows only)
- hosting properties
Request Packet Structure
A request XML packet retrieving information on a subdomain includes the get operation node:
<packet version="1.5.2.0">
<subdomain>
<get>
...
</get>
</subdomain>
</packet>
The get node is presented by the SubdomainGetInputType
(subdomain.xsd
). Its graphical representation is as follows:
Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.
- The filter node is required. It specifies the filtering rule.
For information on filters, refer to the Available
Filters section. Data type: SubdomainFilterType
(
subdomain.xsd
).
Response Packet Structure
The get node of the output XML packet is structured as follows:
Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.
- The result node is required. It wraps the response retrieved
from the server. Data type: resultFilterType (
common.xsd
). - The status node is required. It specifies the execution status
of the get operation. Data type: result_status
(
common.xsd
). Allowed values:ok|error
. - The errcode node is required if the get operation fails. It returns the error code. Data type: unsignedInt.
- The errtext node is required if the get operation fails. It returns the error message. Data type: string.
- The filter-id node is required if the get operation succeeds. It returns the parameter by which the subdomain was filtered in the request packet. Data type: anySimple.
- The id node is required if the get operation succeeds. It
returns the ID of the subdomain which settings are retrieved in the
response packet. Data type: id_type (
common.xsd
). - The data node is required if the get operation succeeds. It
returns a collection of requested subdomain settings. Data type:
SubdomainObjectType (
subdomain.xsd
). See the structure of this node below.
The data node is defined by complex type SubdomainObjectType
(subdomain.xsd
). It is structured as follows:
- The parent node is required. It returns a name of a parent site/subdomain. Data type: string.
- The name node is required. It returns subdomain name. Data type: string.
- The home node is used on Plesk for Windows only. It returns 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 - The property node is required. It returns a hosting setting. To
see the structure of this node, refer to the section Subdomain
Properties. Data type: SubdomainPropertyType
(
subdomain.xsd
).
Possible Errors
- 1006 - Permission is denied.
- 1013 - Subdomain does not exist.
- 1015 - Parent site/subdomain is not found.
- 1023 - Operation failed.
Samples
Getting information on a particular subdomain
This packet retrieves information on the subdomain forum. example.com.
<packet>
<subdomain>
<get>
<filter>
<name>forum.example.com</name>
</filter>
</get>
</subdomain>
</packet>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<subdomain>
<get>
<result>
<status>ok</status>
<filter-id>forum.example.com</filter-id>
<id>3</id>
<data>
<parent>example.com</parent>
<name>forum.example.com</name>
<property>
<name>asp</name>
<value>false</value>
</property>
<property>
<name>ssi</name>
<value>false</value>
</property>
<property>
<name>php</name>
<value>true</value>
</property>
<property>
<name>php_handler_id</name>
<value>fastcgi</value>
</property>
<property>
<name>cgi</name>
<value>true</value>
</property>
<property>
<name>perl</name>
<value>true</value>
</property>
<property>
<name>python</name>
<value>true</value>
</property>
<property>
<name>fastcgi</name>
<value>true</value>
</property>
<property>
<name>ssl</name>
<value>true</value>
</property>
<property>
<name>same_ssl</name>
<value>true</value>
</property>
<property>
<name>www_root</name>
<value>/var/www/vhosts/example.com/forum.example.com</value>
</property>
<property>
<name>webstat</name>
<value>webalizer</value>
</property>
<property>
<name>webstat_protected</name>
<value/>
</property>
</data>
</result>
</get>
</subdomain>
</packet>
Getting information on all subdomains of a domain
This packet retrieves information on all subdomains existing on the site example.com.
<packet>
<subdomain>
<get>
<filter>
<parent-name>example.com</parent-name>
</filter>
</get>
</subdomain>
</packet>
Getting information on all subdomains of a server
This packet retrieves information on all subdomains hosting on the server.
<packet>
<subdomain>
<get>
<filter/>
</get>
</subdomain>
</packet>