Use the get-patterns operation to retrieve patterns from a specified list of a specified user (Administrator or mailbox owner).

Request Packet Structure

A request XML packet retrieving a pattern includes the get-patterns operation node:

<packet>
<spamfilter>
<get-patterns>
...
</get-patterns>
</spamfilter>
</packet>

The get-patterns node is presented by the SpamFilterGetPatternsInputType type (spamfilter.xsd), and its graphical representation is as follows:

image 36788

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 filter node is optional. It specifies the filtering rule. Data type: SpamassassinFilterType (spamfilter.xsd).
  • The list node is required. It specifies the type of the list. For information on list types, refer to the Types of Server Lists and Types of Lists available for Mailbox Owners sections. Data type: SpamListType (spamfilter.xsd). Allowed values: black | white | unblack | unwhite.

Remarks

You can retrieve multiple lists for users specified by different filtering rules in a single packet. Add as many get-patterns operations as the number of different filtering rules to be applied.

<get-patterns>
   ...
</get-patterns>
   ...
<get-patterns>
   ...
</get-patterns>

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

Response Packet Structure

The get-patterns node of the output XML packet is presented by type SpamFilterGetPatternsOutputType (spamfilter.xsd) and structured as follows:

image 36791

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 response retrieved from the server. Data type: ResultFilterType (common.xsd).
  • The status node is required. It specifies the execution status of the get-patterns operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the get-patterns operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the get-patterns operation fails. Data type: string.
  • The filter-id node is optional. It holds the filtering rule parameter. For information, refer to the Available Filters section. Data type: anySimpleType.
  • The id node is optional. It returns the ID of the Spamassassin user, if the operation succeeds. Data type: integer.
  • The pattern node is optional. It holds a pattern of the specified list. Data type: string.

Remarks

If a list contains more than one pattern, the set of patterns will look as follows: <pattern>…</pattern>…<pattern>…</pattern>. For more information, refer to the Response Samples section.

Samples

Retrieving patterns from a single list

This request packet retrieves patterns from server white list.

<packet>
<spamfilter>
   <get-patterns>
      <filter>
         <username>admin</username>
      </filter>
      <list>white</list>
   </get-patterns>
</spamfilter>
</packet>

Response:

<packet>
<spamfilter>
   <get-patterns>
   <result>
      <status>ok</status>
      <filter-id>admin</filter-id>
      <id>1</id>
      <pattern>*@spam.net</pattern>
      <pattern>maillist@subscribespam.net</pattern>
      <pattern>*.ua</pattern>
   </result>
   </get-patterns>
</spamfilter>
</packet>

Retrieving patterns from multiple lists

This request packet retrieves patterns from unwhite list of mailboxes mybox@site.com and my@site.com.

<packet>
<spamfilter>
<get-patterns>

   <filter>
      <username>mybox@site.com</username>
      <username>my@site.com</username>
   </filter>

<list>unwhite</list>
</get-patterns>
</spamfilter>
</packet>

Response (if user my@site.com was not found on the server):

<packet>
<spamfilter>
   <get-patterns>
   <result>
      <status>ok</status>
      <filter-id>admin</filter-id>
      <id>16</id>
      <pattern>*.ua</pattern>
   </result>

   <result>
      <status>error</status>
      <errcode>1015</errcode>
      <errtext>User does not exist.</errtext>
      <filter-id>my@site.com</filter-id>
   </result>
   </get-patterns>
</spamfilter>
</packet>