This is documentation for Plesk 12.5.
Go to documentation for the latest version, Plesk Obsidian.
Creating Protected Directory User
Use the add-user operation to create a protected directory user.
Request Packet Structure
A request XML packet adding a protected directory user includes the add-user operation node:
<packet>
<protected-dir>
<add-user>
...
</add-user>
</protected-dir>
</packet>
The add-user node is presented by type ProtectedDirAddUserlInput (protected_dir.xsd
), and its graphical representation is as follows:
- The pd-id node is required. It specifies the protected directory ID. Data type: integer.
- The login node is required. It specifies the protected directory user login. Data type: string.
- The password node is required. It specifies the protected directory user password. Data type: string.
- The password-type node is optional. It specifies the protected directory user password type. Data type: string. Allowed values: plain | crypt.
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The add-user node of the output XML packet is presented by type ProtectedDirAddUserOutput (protected_dir.xsd
) and structured as follows:
- The result node is required. It wraps the response retrieved from the server. Data type: resultType (
common.xsd
). - The status node is required. It specifies the execution status of the operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. Is returns the error code if the operation fails. Data type: integer.
- The errtext node is optional. It returns the error message if the operation fails. Data type: string.
- The id node is required if the operation succeeds. It returns the ID of the added protected directory user. Data type: integer.
Samples
The packet that creates user MyUser for the protected directory with ID 1 looks as follows:
<packet version="1.5.2.0">
<protected-dir>
<add-user>
<pd-id>1</pd-id>
<login>MyUser</login>
<password>12345</password>
<password-type>plain</password-type>
</add-user>
</protected-dir>
</packet>
Response:
<packet version="1.5.2.0">
<protected-dir>
<add-user>
<result>
<status>ok</status>
<id>1</id>
</result>
</add-user>
</protected-dir>
</packet>
If the user already exists, the response from the server looks as follows:
<packet version="1.5.2.0">
<protected-dir>
<add-user>
<result>
<status>error</status>
<errcode>1007</errcode>
<errtext>Specified user is already exist</errtext>
</result>
</add-user>
</protected-dir>
</packet>