You can retrieve information on users of the certain database. To retrieve information on database users, specify the ID of the database. You can retrieve information about users of multiple databases in a single get-db-users operation.

Request Packet Structure

A request XML packet retrieving users info from the database includes the get-db-users operation node:

<packet>
<database>
   <get-db-users>
   ...
   </get-db-users>
</database>
</packet>

The get-db-user node is presented by type DatabaseGetDBUserInputType (database_input.xsd), and its graphical representation is as follows:

image 37569

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. Specifies the filtering rule. For more information, refer to the Available Filters section. Data type: DatabaseUserFilterType.
  • The id node is optional. It specifies the ID of the database user whose information is to be retrieved. Data type: integer.
  • The db-id node is optional. It specifies the ID of the database from which information about users is retrieved. Data type: integer.

Remarks

You can retrieve information from multiple databases using a single get-db-users operation. Add as many db-id parameters to the filtering rule as the number of different databases you want to scan.

<database>
<get-db-users>
   <filter>
      <db-id>...</db-id>
      ...
      <db-id>...</db-id>
   </filter>
</get-db-users>
</database>

Note: Use the <filter/> parameter to retrieve information about all users from all databases available for the user identified by credentials from HTTP header.

Response Packet Structure

The get-db-users node of the output XML packet is presented by type DatabaseGetDBUsersOutputType (database_output.xsd) and structured as follows:

image 37570

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-db-users operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the get-db–users operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the get-db–user operation fails. Data type: string.
  • The filter-id node is optional. It returns the filtering rule parameter. For more information, refer to the Available Filters section.
  • The id node is optional. If the get-db-users operation succeeds, it specifies the database user ID. Data type: integer.
  • The login node is optional. If the get-db-users operation succeeds, it specifies login name of the database user. Data type: string.
  • The db-id node is optional. If the get-db-users operation succeeds, it specifies ID of the database where the user is located. Data type: integer.

Samples

Retrieving information about database users

This request packet retrieves information on all users of the database with ID 79.

<packet>
<database>
   <get-db-users>
      <filter>
          <db-id>79</db-id>
      </filter>
   </get-db-users>
</database>
</packet>

Response:

<packet>
<database>
   <get-db-users>

      <result>
          <status>ok</status>
          <filter-id>79</filter-id>
          <id>15</id>
          <login>UserOne</login>
          <db-id>79</db-id>
      </result>

      <result>
          <status>ok</status>
          <filter-id>79</filter-id>
          <id>15</id>
          <login>UserTwo</login>
          <db-id>79</db-id>
      </result>

   </get-db-users>
</database>
</packet>

Retrieving information about all users of all databases

This request packet retrieves information on all users of all available databases.

<packet>
<database>
   <get-db-users>
      <filter/>
   </get-db-users>
</database>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <database>
    <get-db-users>
      <result>
        <status>ok</status>
      </result>
    </get-db-users>
  </database>
</packet>