Retrieving Local Database Servers Info

Use the get-local operation to retrieve info on local database servers of the specified type. You can retrieve preferences of multiple local database servers in a single packet.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

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

<packet version="1.6.7.0">
<db_server>
  <get-local>
  ...
  </get-local>
</db_server>
</packet>

 

The get-local 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 type node is optional. It specifies the type of local database servers. Data type: string. Allowed values: mssql | mysql | postgresql.

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

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

<db_server>
   <get-local>
   ...
   </get-local>
...
   <get-local>
   ...
   </get-local>
</db_server>
 

Response Packet Structure

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

Samples

Retrieving info on a single database server

This request packet retrieves info on the MySQL local database server.

<packet>
<db_server>
 <get-local>
   <filter>
      <type>mysql</type>
   </filter>
 </get-local>
</db_server>
</packet>

Response:

<packet>
<db_server>
   <get-local>
      <result>
         <status>ok</status>
         <type>mysql</type>
         <id>1</id>
      </result>
   </get-local>
</db_server>
</packet>

If the type of database server was invalid, the response from the server looks as follows:

<packet>
<db_server>
   <get-local>
      <result>
         <status>error</status>
         <errcode>14007</errcode>
         <errtext>Unsupported database type</errtext>
         <type>NewSQL</type>
      </result>
   </get-local>
</db_server>
</packet>
Retrieving info on multiple database servers

This request packet retrieves info on all local database servers.

<packet>
<db_server>
 <get-local>
   <filter/>
 </get-local>
</db_server>
</packet>

Response:

<packet>
<db_server>
   <get-local>
      <result>
         <status>ok</status>
         <type>mysql</type>
         <id>1</id>
      </result>
      <result>
         <status>ok</status>
         <type>postgresql</type>
         <id>2</id>
      </result>
   </get-local>
</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.