Use the add operation to add a new protected directory.
A request XML packet adding a new protected directory includes the add operation node:
<packet>
<protected-dir>
<add>
...
</add>
</protected-dir>
</packet>
The add node is presented by the ProtectedDirAddInput type (protected_dir.xsd
), and its graphical representation is as follows:
Note: The location node can be specified only in Plesk for Linux/Unix. The SSL support parameter is inherited from settings of the site: If it is enabled on the site, it will also be enabled for the protected directory. If the node is not present in the request packet, the protected directory will be created with default settings ssl=true/false (depending on site settings), nonssl=true and cgi=false.
protected_dir.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 presented by type ProtectedDirAddOutput (protected_dir.xsd
) and structured as follows:
common.xsd
).
The following request packet creates MyDirectory
protected directory on the site with ID 1. The packet is valid only in Plesk for Linux/Unix.
<packet version="1.6.3.0">
<protected-dir>
<add>
<site-id>1</site-id>
<name>MyDirectory</name>
<header>This is a header!</header>
<location>
<property>
<name>ssl</name>
<value>true</value>
</property>
<property>
<name>nonssl</name>
<value>false</value>
</property>
<property>
<name>cgi</name>
<value>false</value>
</property>
</location>
</add>
</protected-dir>
</packet>
Response:
<packet version="1.6.3.0">
<protected-dir>
<add>
<result>
<status>ok</status>
<id>1</id>
</result>
</add>
</protected-dir>
</packet>
If site was not found, the response is as follows:
<packet version="1.6.3.0">
<protected-dir>
<add>
<result>
<status>error</status>
<errcode>1015</errcode>
<errtext>site is not found</errtext>
</result>
...
</add>
</protected-dir>
</packet>
If MyDirectory
directory already exists, the response is as follows:
<packet version="1.6.3.0">
<protected-dir>
<add>
<result>
<status>error</status>
<errcode>1007</errcode>
<errtext>URL with name 'name' already exists</errtext>
</result>
...
</add>
</protected-dir>
</packet>