You can manage databases either in the database management tool (such as phpMyAdmin) or by connecting directly to the database server. To access a database in the database management tool, Plesk uses the default database user if no other user is specified. You can set any database user account as the default. If you create a new database, the first user created in the database will be set as the default database user.

Request Packet Structure

A request XML packet retrieving the default database user information includes the get-default-user operation node:

<packet>
<database>
   <get-default-user>
   ...
   </get-default-user>
</database>
</packet>

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

image 37563

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: DatabaseDefaultUserFilterType.
  • The db-id node is optional. It specifies ID of a database. Data type: integer.

Remarks

You can retrieve ID’s of multiple default database users by using a single request packet. Add the get-default-user operation for each database to the request packet.

<database>
   <get-default-user>
   ...
   </get-default-user>
...
   <get-default-user>
   ...
   </get-default-user>
</database>

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

Response Packet Structure

The get-default-user node of the output XML packet is presented by type DatabaseGetDefaultUserOutputType (database_output.xsd) and structured as follows:

image 37564

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: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the get-default-user operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the get-default-user operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the get-default-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 required. It specifies the ID of the default database user. Data type: integer.

Samples

Retrieving information on the default database user

This packet retrieves a default database user of the database with ID 35.

<packet>
<database>
   <get-default-user>
      <filter>
          <db-id>35</db-id>
      </filter>
   </get-default-user>
</database>
</packet>

Response:

<packet>
<database>
   <get-default-user>
      <result>
          <status>ok</status>
          <filter-id>35</filter-id>
          <id>77</id>
      </result>
   </get-default-user>
</database>
</packet>

A negative response from the server can look as follows:

<packet>
<database>
   <get-default-user>
      <result>
          <status>error</status>
          <errcode>1013</errcode>
          <errtext>Database not found</errtext>
      </result>
   </get-default-user>
</database>
</packet>

Retrieving information on multiple default database users

This packet retrieves default database users of all databases on all database servers available for the packet sender.

<packet>
<database>
   <get-default-user>
      <filter/>
   </get-default-user>
</database>
</packet>

Reponse:

<packet>
<database>
   <get-default-user>

      <result>
          <status>ok</status>
          <filter-id>15</filter-id>
          <id>77</id>
      </result>

      <result>
          <status>ok</status>
          <filter-id>35</filter-id>
          <id>17</id>
      </result>

      <result>
          <status>ok</status>
          <filter-id>24</filter-id>
          <id>72</id>
      </result>

   </get-default-user>
</database>
</packet>