Changing Protected Directory Properties

Use the set operation to change protected directory properties.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet changing protected directory properties includes the set operation node:

<packet>
<protected-dir>
<set>
...  
</set>
</protected-dir>
</packet>

 

The set node is presented by type ProtectedDirAddInput (protected_dir.xsd), and its graphical representation is as follows:

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The set node of the output XML packet is presented by type ProtectedDirSetOutput (protected_dir.xsd) and structured as follows:

 

 

Samples

Changing properties of a single protected directory

The following packet changes properties of the protected directory with ID 1. The packet is valid only in Plesk for Linux/Unix.

<packet>
<protected-dir>
    <set>
       <filter>
          <id>1</id>
       </filter>
       <values>
         <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>
      </values>
    </set>
  </protected-dir>
</packet>

Response:

<packet>
<protected-dir>
      <set>
        <result>
          <status>ok</status>
          <filter-id>1</filter-id>
          <id>1</id>
        </result>
      </set>
    </protected-dir>
</packet>

 

If the directory was not found, the response from the server is as follows:

<packet>
<protected-dir>
  <set>
    <result>
     <status>error</status>
     <errcode>1013</errcode>
     <errtext>Protected URL is not found</errtext>
     <filter-id>1</filter-id>
    </result>
  </set>
</protected-dir>
</packet>

 

If invalid header text was specified in the request packet, the response from the server looks as follows:

<packet>
<protected-dir>
  <set>
    <result>
     <status>error</status>
     <errcode>1019</errcode>
     <errtext>Invalid value for 'header' specified</errtext>
     <filter-id>1</filter-id>
    </result>
  </set>
</protected-dir>
</packet> 
Changing properties of multiple protected directories

The following packet changes properties of all protected directories available for a packet sender. The packet is valid only in Plesk for Linux/Unix.

<packet>
<protected-dir>
    <set>
       <filter/>
       <values>
         <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>
       </values>
    </set>
  </protected-dir>
</packet>

Response:

<packet>
<protected-dir>
      <set>
        <result>
          <status>ok</status>
          <filter-id>1</filter-id>
          <id>1</id>
        </result>
        <result>
          <status>ok</status>
          <filter-id>2</filter-id>
          <id>2</id>
        </result>
      </set>
    </protected-dir>
</packet>