Use the remove operation to remove a virtual directory.

Request Packet Structure

A request XML packet that deletes a virtual directory should include the remove operation node:

<packet>
<virtdir>
   <remove>


   </remove>
</virtdir>
</packet>

The remove node is presented by type RemoveVDirInputType (virtdir.xsd). Its graphical representation is as follows:

image 34266

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 site-id node is required. It holds the identifier of the site that owns the virtual directory. Data type: integer.
  • The subdomain-id node is required. it holds the identifier of the subdomain that owns the virtual directory. Data type: integer.
  • The name node is required. It holds the name of the virtual directory. Data type: VDirPath (common.xsd).

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

Response Packet Structure

The remove node of the output XML packet is structured as follows:

:image 34267

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 result of the remove operation. Data type: resultType (common.xsd).
  • The status node is required. Specifies the execution status of the remove operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is required if the remove operation fails. Returns the error code. Data type: unsignedInt.
  • The errtext node is optional. Can be returned if the remove operation fails. Returns the error message. Data type: string.

Samples

Deleting a single virtual directory

The following packet deletes a virtual directory with the specified name from the virtual host (site):

<packet version="1.6.3.0">
<virtdir>
   <remove>
      <site-id>1</site-id>
      <name>/my_vdir</name>
   </remove>
</virtdir>
</packet>

Response:

<packet version="1.6.7.0">
<virtdir>
<remove>
    <result>
       <status>ok</status>
    </result>
</remove>
</virtdir>
</packet>

Deleting multiple virtual directories

To delete multiple virtual directories with a single packet, use multiple remove sections:

<packet version="1.6.3.0">
<virtdir>
   <remove>
      <site-id>1</site-id>
      <name>/my_vdir</name>
   </remove>
   <remove>
      <site-id>2</site-id>
      <name>/my_vdir</name>
   </remove>
</virtdir>
</packet>

Response:

<packet version="1.6.7.0">
<virtdir>
<remove>
    <result>
       <status>ok</status>
    </result>
</remove>
<remove>
    <result>
       <status>ok</status>
    </result>
</remove>
</virtdir>
</packet>

The remove sections will follow one another in the order they have been sent within the request packet.