Deleting Databases

Use the del-db operation to remove one or more databases.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 
Request Packet Structure

A request XML packet deleting a database includes the del-db operation node:

<packet version="1.6.7.0">
<database>
   <del-db>
   ...
   </del-db>
</database>
</packet>

 

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

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 information on filters, refer to the Available Filters section. Data type: DatabaseFilterType.

Note: If the filter node is blank, all databases are removed.

 
Response Packet Structure

The del-db node of the output XML packet is presented by type DatabaseDelDBOutputType (database_output.xsd) and 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: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the del-db operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the del-db operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the del-db 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 add-db operation succeeds it returns the ID of the database.
 
Samples
Deleting a database

The request packet looks as follows:

<packet>
<database>
<del-db>
   <filter>
      <db-id>55</db-id>
   </filter>
</del-db>
</database>
</packet>

Response:

<packet>
<database>
   <del-db>

   <result>
      <status>ok</status>
      <filter-id>55</filter-id>
      <id>55</id>
   </result>

   </del-db>
</database>
</packet>

 

Negative response from the server can look as follows:

<packet">
<database>
   <del-db>

   <result>
      <status>error</status>
      <errcode>1013</errcode>
      <errtext>Database does not exist</errtext>
      <filter-id>55</filter-id>
   </result>

   </del-db>
</database>
</packet>
Deleting multiple databases

The request packet looks as follows:

<packet>
<database>

<del-db>
   <filter/>
</del-db>

<del-db>
   <filter>
      <db-id>15</db-id>
   </filter>
</del-db>

</database>
</packet>

 Response:

<packet>
<database>
   <del-db>

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

   <result>
      <status>ok</status>
      <filter-id>43</filter-id>
      <id>43</id>
   </result>

   <result>
      <status>error</status>
      <errcode>1013</errcode>
      <errtext>Database does not exist</errtext>
      <filter-id>15</filter-id>
   </result>

   </del-db>
</database>
</packet>

 The last result shows error, because the database with ID 15 is already deleted.