Retrieving Information on Site Aliases

In this chapter:

The get operation is used to retrieve info on site aliases from Plesk database that includes the following parameters:

  • Site alias preferences
  • Primary site id and name
 

Request Packet Structure

A request XML packet retrieving a site alias settings from Plesk database includes the get operation node:

<packet version="1.6.3.0">
<site-alias>
   <get>
   ...
   </get>
</site-alias>
</packet>

 

The get node 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: domainAliasFilterType (domainalias_input.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 received from the server. Data type: resultFilterType (common.xsd).

The status node is required. Specifies the execution status of the get operation. Data type: string. Allowed values: ok | error.

  • The errcode node is optional. Is used to return the error code when the get operation fails. Data type: unsignedInt.
  • The errtext node is optional. Can be used to return the error message if the get operation fails. Data type: string.
  • The id node is optional. It returns the site alias id; it is required if the get operation has succeeded or if this id was specified in the request packet. Data type: integer.
  • The filter-id node is optional. It returns a filtering rule parameter. For more information, refer to the Available Filters section. Data type:anySimple.
  • The info node is optional. It is present if the get operation succeeds and contains the alias preferences. For more information, refer to the Site Alias Settings section. Data type: AliasInfoType (plesk_domainalias.xsd).
 

Samples

Retrieving settings of a single site alias

This packet retrieves preferences of the site alias called MyAlias.com.

<packet>
<site-alias>
<get>
   <filter>
      <name>MyAlias.com</name>
   </filter>
</get>
</site-alias>
</packet> 

A positive response received from the server after retrieving info on the site alias can look as follows:

<packet>
<site-alias>
<get>
   <result>
      <status>ok</status>
      <info>
          <prefs>
             <web>true</web>
             <mail>false</mail>
             <tomcat>false</tomcat>             
          </prefs>
          <site-id>3</site-id>
          <name>MyAlias.com</name>
          <ascii-name>MyAlias.com</ascii-name>
      </info>
   </result>
</get>
</site-alias>
</packet>
Retrieving settings of multiple site aliases

This packet retrieves preferences of the site aliases called MyAlias.com and MySecondAlias.com.

<packet>
<site-alias>
<get>
   <filter>
      <name>MyAlias.com</name>
      <name>MySecondAlias.com</name>
   </filter>
</get>
</site-alias>
</packet>

A positive response got from the server can look as follows (two site aliases exist for this site name):

<packet>
<site-alias>
<get>
   <result>
      <status>ok</status>
      <info>
          <prefs>
             <web>false</web>
             <mail>false</mail>
             <tomcat>false</tomcat>             
          </prefs>
          <site-id>3</site-id>
          <name>MyAlias.com</name>
          <ascii-name>MyAlias.com</ascii-name>
      </info>
   </result>

   <result>
      <status>ok</status>
      <info>
          <prefs>
             <web>true</web>
             <mail>false</mail>
            <tomcat>false</tomcat>             
          </prefs>
          <site-id>3</site-id>
          <name>My2Alias.com</name>
          <ascii-name>My2Alias.com</ascii-name>
      </info>
   </result>
</get>
</site-alias>
</packet> 

The following packet is wrong because both name and site-id are used for identification.

<packet>
<site-alias>
<get>
   <filter>
      <name>MyAlias.com</name>
      <site-id>12</site-id>
   </filter>
</get>
</site-alias>
</packet>

 

This packet retrieves preferences of all site aliases on the server.

<packet>
<site-alias>
<get>
   <filter/>
</get>
</site-alias>
</packet>
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.