Retrieving Database Server Parameters

Use get operation to retrieve parameters of the database server specified by ID. You can retrieve preferences of multiple database servers in a single operation.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

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

<packet>
<db_server>
  <get>
  ...
  </get>
</db_server>
</packet>

 

The get node has the following graphical representation:

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 id node is optional. Specifies the database server ID. Data type: integer.

Note: If the filter node is left blank (<filter/>), the operation will return info on all database servers.

Remarks

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

<db_server>
   <get>
   ...
   </get>
...
   <get>
   ...
   </get>
</db_server>
 

Response Packet Structure

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

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

  • The data node is optional. Data type: databaseServerDescription (plesk_db.xsd) If the get operation succeeded it returns the following data:
    • The host node is optional. Specifies the IP address or name of the database server. Data type: string.
    • The port node is optional. It specifies the port of the database server. Data type: string.
    • The type node is required. It returns the type of the database server. Data type: string.
    • The admin node is required. It specifies the login name of administrator of the database server. Data type: integer.
    • The password node is optional. It specifies the password of the administrator of the database server. Data type: integer.
    • The status node is required. It specifies the status of connection to the database server. Data type: string. Allowed values: NO_ERROR | CONNECTION_FAILED | LOGIN_FAILED | PERMISSION_DENIED | OTHER_ERROR | CREDENTIALS_NOT_SET
    • The db_num node is required. It specifies the number of databases managed by the database server. Data type: integer.
    • The default node is optional. It specifies a default database server. Data type: none.
  • The local node is optional. It specifies a local database server. Data type: none.

 

 

Samples

Retrieving a single database server

This packet retrieves the database server specified by ID 7

<packet>
<db_server>
  <get>
   <filter>
    <id>7</id>
   </filter>
   </get>
  </db_server>
</packet>

Response:

<packet>
<db_server>
  <get>
   <result>
     <status>ok</status>
        <id>7</id>
        <data>
          <host>14.13.11.2</host>
          <port>5432</port>
          <type>mysql</type>
          <admin></admin>
          <status>CREDENTIALS_NOT_SET</status>
          <db_num>0</db_num>
        </data>
   </result>
  </get>
</db_server>
</packet>

 If the database server was not found, the result is as follows:

<packet>
<db_server>
  <get>
   <result>
     <status>error</status>
     <errcode>1013</errcode>
     <errtext>Database server does not exist.</errtext>
   </result>
  </get>
</db_server>
</packet>
Retrieving multiple database servers

This request packet retrieves info on the database servers specified by ID 2 and ID 92.

<packet>
<db_server>
  <get>
   <filter>
    <id>2</id><id>92</id>
   </filter>
   </get>
  </db_server>
</packet>

Response:

<packet>
<db_server>
  <get>
   <result>
     <status>ok</status>
        <id>2</id>
        <data>
          <host>localhost</host>
          <port>5432</port>
          <type>postgresql</type>
          <admin></admin>
          <status>CREDENTIALS_NOT_SET</status>
          <db_num>0</db_num>
          <default></default>
          <local></local>
        </data>
   </result>
   <result>
     <status>ok</status>
        <id>92</id>
        <data>
          <host>some.host</host>
          <port>5432</port>
          <type>postgresql</type>
          <admin>admin</admin>
          <password>qweqwe</password>
          <status>OTHER_ERROR</status>
          <db_num>0</db_num>
        </data>
   </result>
  </get>
</db_server>
</packet>

 

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.