A default database server manages all databases of the corresponding type. Only one default database server for each type of databases is available in Plesk. Use the get-default operation to retrieve a default database server.

Request Packet Structure

A request XML packet retrieving a default database server info includes the get-default operation node:

<packet>
<db_server>
  <get-default>
  ...
  </get-default>
</db_server>
</packet>

The get-default node has the following graphical representation:

image 37594

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. Data type: none.

The type node is required. It specified the default database of which type to retrieve. Data type: string. Allowed values: mysql | postgresql | mssql.

Note: If the filter node is left blank (<filter/>), the operation will return default database servers for all types of databases.

A single packet can retrieve the data of multiple default database servers. Add as many different type parameters as the number of default database servers info on which you want to retrieve.

<db_server>
   <get-default>
   ...
   </get-default>
...
   <get-default>
   ...
   </get-default>
</db_server>

Response Packet Structure

The get-default node of the output XML packet is structured as follows:

image 37596

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

Samples

Retrieving status of a database server

This request packet retrieves default Microsoft SQL database server info.

<packet>
<db_server>
 <get-default>
   <filter>
     <type>mssql</type>
   </filter>
 </get-default>
</db_server>
</packet>

Response:

<packet>
<db_server>
 <get-default>
   <result>
     <status>ok</status>
     <type>mssql</type>
   </result>
 </get-default>
</db_server>
</packet>

If an unsupported type was specified in the request packet, the response from the server looks as follows:

<packet>
<db_server>
 <get-default>
   <result>
     <status>error</status>
     <errcode>14006</errcode>
     <errtext>unsupported database type</errtext>
     <type>mssql</type>
   </result>
 </get-default>
</db_server>
</packet>

Retrieving status of multiple database servers

This packet retrieves default MySQL and PostgreSQL database servers info.

<packet>
<db_server>
 <get-default>
   <filter>
     <type>mysql</type>
     <type>postgresql</type>
   </filter>
 </get-default>
</db_server>
</packet>

Response:

<packet>
<db_server>
 <get-default>

   <result>
     <status>ok</status>
     <type>mysql</type>
   </result>

   <result>
     <status>ok</status>
     <type>postgresql</type>
   </result>

 </get-default>
</db_server>
</packet>