Creating Site Aliases
Only Plesk Administrator can create site aliases via API RPC. To create a site alias, it is enough to specify the site ID and the site name.
You can also specify alias settings when creating a site alias (all of them are optional):
- Alias status
- Alias preferences
You can specify alias settings during or after creation of an alias. Alias settings can be set using the set operation. To get information on which site alias settings can be set on a particular server, use the get-supported-services operation.
Request Packet Structure
A request XML packet creating a new site alias in Plesk database includes the create operation node:
The create node is presented by the AliasInfoType type (
plesk_domainalias.xsd). Its graphical representation is as follows:
- The status node is optional. It specifies the status of a site alias. For more information, see the Site Alias Settings section. Data type: string. Allowed values: ok | error.
- The pref node is optional. It specifies preferences of a site alias. For more information, see the Site Alias Settings section. Data type: none.
- The manage-dns node is optional. It defines if you can manage DNS zone for the site alias.
- The site-id node is required. It specifies the id of the primary site. Data type: integer.
- The name node is required. It specifies the name of the primary site. Data type: string (Unicode).
- The ascii-name node is optional. It specifies the name of the primary site. Data type: string (ASCII).
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The create 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: AliasResultType (
- The status node is required. It specifies the execution status of the create operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. It is used to return the error code when the create operation fails. Data type: unsignedInt.
- The errtext node is optional. Can be used to return the error message if the create operation fails. Data type: string.
- The id node is optional. It returns the ID of the site alias; it is required if the create operation has succeeded. Returns the unique identifier of the site alias just added to Plesk. Data type: integer.
Creating a single site alias
To create a site alias, specify the ID of the primary site (the alias will be linked to) and name of the alias.
Creating multiple site aliases
To create two site aliases with a single packet, include two different create operations:
The following packet creates site aliases to the site with ID 12. The alias settings are as follows:
- DisabledAlias is disabled.
EnabledWebOnlyAlias is enabled and has only web content redirection.