Use the set-prefs operation to change preferences common for all users of the certain site. These settings automatically will be set for a new user added to the site. Web users preferences are of more priority than web users settings. For more information on the settings, refer to the Retrieving Web Users Settings, and Web User Settings/Preferences sections.

Request Packet Structure

A request XML packet updating preferences of web users includes the set-prefs operation node:

<packet>
<webuser >
   <set-prefs>
   ...
   </set-prefs>
</webuser>
</packet>

The set-prefs node is presented by type WebUserSetPrefInputType (webuser.xsd), and its graphical representation is as follows:

image 34367

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 required. It specifies the filtering rule. For more information, refer to the Available Filters section. Data type: WebUserOwnFilter (webuser.xsd)
  • The values node is required. It specifies preferences of a site. For more information, refer to the Preferences section. Data type: WebUserPrefs (webuser.xsd)

Remarks

You can update preferences of web users using different filtering rules in a single packet. Add as many set-prefs operations as the number of different filtering rules to be used.

<packet>
<set-prefs>
...
</set-prefs>
...
<set-prefs>
...
</set-prefs>
</packet>

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

Response Packet Structure

The set-prefs node of the output XML packet is presented by type WebUserSetPrefOutputType (webuser.xsd) and structured as follows:

image 34371

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 set-prefs operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It returns the error code if the set-prefs operation fails. Data type: unsignedInt.
  • The errtext node is optional. It returns the error message if the set-prefs operation fails. Data type: string.
  • The filter-id node is required. It returns filtering rule parameter. For more information, refer to the Available Filters section. Data type: anySimpleType.
  • The id node is optional. If the set-prefs operation succeeds it holds the id of the updated web user. Data type: integer.

Samples

Updating preferences of a single site

The request packet disables scripts execution for all web users of the site with ID 4.

<packet>
<webuser>
<set-prefs>
   <filter>
      <site-id>4</site-id>
   </filter>
   <values>
      <wuscripts>0</wuscripts>
   </values>
</set-prefs>
</webuser>
</packet>

Response:

<packet>
<webuser>
<set-prefs>
   <result>
      <status>ok</status>
      <filter-id>4</filter-id>
      <id>4</id>
   </result>
</set-prefs>
</webuser>
</packet>

Updating preferences of multiple sites

This request packet disables scripts execution, and sites like username@<site> for all web users of the example.com and example2.com sites.

<packet>
<webuser>
<set-prefs>
   <filter>
      <site-id>example.com</site-id>
      <site-id>example2.com</site-id>
   </filter>
   <values>
      <wuscripts>0</wuscripts>
   </values>
</set-prefs>
</webuser>
</packet>

Response (if example2.com wasn’t found on the server):

<packet>
<webuser>
<set-prefs>

   <result>
      <status>ok</status>
      <filter-id>Domain1.com</filter-id>
      <id>4</id>
   </result>

   <result>
      <status>error</status>
      <errcode>1015</errcode>
      <errtext>Domain does not exist</errtext>
      <filter-id>Domain2.com</filter-id>
   </result>

</set-prefs>
</webuser>
</packet>