Available Filters

Filtering is the way the request packets pick out FTP accounts to which the requested operation will be applied.

 

In this chapter:

Filtering in Requests

Filtering in Responses

 

Filtering in Requests

The filter node is presented by the FtpUserFilterType complex type (ftpuser.xsd). This data type is structured as follows:

ftpuser_filter

  • The id node is required. It specifies the FTP account ID in Plesk database. Data type: integer.
  • The name node is required. It specifies the name of FTP account. Data type: string.
  • The webspace-id node is required. It specifies the unique identifier of the site on which the FTP account exists. Data type: integer.
  • The webspace-name node is required. It specifies the name of the site (in Unicode) on which the FTP account exists. Data type: string.

The filter allows two kinds of filtering:

  • Nodes id and name serve to filter one to many FTP accounts individually. Individual filtering is allowed to Plesk Administrator, customer (on their own sites) and Plesk Domain Administrators (on their own site).
  • Nodes site-id and site-name serve to filter all FTP accounts on a certain site (or several) at one stroke. This kind of filtering is allowed to Plesk Administrator, and Plesk customer (on their own sites).

 

Individual filtering

The following packet requests information on properties of three FTP accounts specified by their ID:

<packet>
<ftp-user>
<get>
   <filter>
      <id>65</id>
      <id>66</id>
      <id>67</id>
   </filter>
</get>
</ftp-user>
</packet>

 

The following packet is identical except it specifies accounts by their names:

<packet>
<ftp-user>
<get>
   <filter>
      <name>willy</name>
      <name>billy</name>
      <name>dilly</name>
   </filter>
</get>
</ftp-user>
</packet>

 

The following packet is invalid as both the id and the name nodes are used in the same filter:

<packet>
<ftp-user>
<get>
   <filter>
      <name>willy</name>
      <id>66</id>
      <name>dilly</name>
   </filter>
</get>
</ftp-user>
</packet>

 

Bulk filtering

The following packet deletes all FTP accounts existing on sites specified by ID:

<packet>
<ftp-user>
<del>
   <filter>
      <webspace-id>638</webspace-id>
      <webspace-id>1498</webspace-id>
   </filter>
</del>
</ftp-user>
</packet>

 

The same packet specifies sites by name:

<packet>
<ftp-user>
<del>
   <filter>
      <webspace-name>doe1.com</webspace-name>
      <webspace-name>doe2.com</webspace-name>
   </filter>
</del>
</ftp-user>
</packet>

 

The following packet is invalid as it uses both the site-id and the site-name nodes within one filter:

<packet>
<ftp-user>
<del>
   <filter>
      <webspace-id>638</webspace-id>
      <webspace-name>doe2.com</webspace-name>
   </filter>
</del>
</ftp-user>
</packet>

 

The following packet sent by Plesk Administrator deletes all FTP accounts existing in Plesk. If sent by customer, it deletes all FTP accounts on all sites of this customer.

<packet>
<ftp-user>
<del>
   <filter/>
</del>
</ftp-user>
</packet>

 

 

Filtering in Responses

If an operation in a request packet (del, get, set) uses filters, the filter-id node is nested in a response packet. It returns the filtering rule. If one of the following values was set as a filter rule, it is returned as the filter-id value in the response packet:

  • FTP account ID
  • FTP account name
  • Domain ID
  • Domain name

It is done so to trace the request parameters in case of an error. Data type: anySimple. The node value can be integer (site or FTP account ID) or a string (site or FTP account name).

If the filter node is left blank (<filter/>), the filter-id parameter will hold the ID of the object. The blank filter means that all objects are matched by this rule.