Use the backup-webspace operation to create a subscription-level backup task.

Request Packet Structure

A request XML packet creating a subscription-level backup task includes the backup-webspace operation node:

<packet>
<backup-manager>
   <backup-webspace>
...
   </backup-webspace>
</backup-manager>
</packet>

The backup-webspace node is presented by type BackupDomainInput (backup.xsd), and its graphical representation is as follows:

image 44478

  • The webspace-id node is required. It specifies the subscription ID. Data type: integer.
  • The webspace-name node is required. It specifies the subscription name. Data type: string.
  • The local node is required. It specifies if the backup will be stored in the local storage. Data type: none.
  • The remote node is required. It specifies if the backup will be stored in a remote storage. Data type: string “ftp”.
  • The prefix node is optional. It specifies the backup name prefix. Data type: string.
  • The description node is required. It specifies the description of the backup. Data type: string.
  • The split-size node is optional. The parameter specifies size of fragments (in Kb) into which the backup is partitioned. Data type: integer.
  • The only-hosting node is optional. The parameter instructs Plesk to exclude mail accounts content from the subscription content added to the backup. Data type: none.
  • The only-mail node is optional. The parameter instructs Plesk to add only mail accounts content to the backup. Data type: none.
  • The only-configuration node is optional. The parameter instructs Plesk to include only subscription configuration into the backup. Data type: none.

Note: If you do not want to split backup into several files, the split-size value must be set to 0.

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

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.

Response Packet Structure

The backup-webspace node of the output XML packet is presented by type BackupCommandOutput (backup.xsd) and structured as follows:

image 44490

  • 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 operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the operation fails. Data type: string.
  • The task-id node is optional. It returns the backup task ID if the operation succeeds. Data type: integer.

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.

Samples

Creating a backup task for a subscription account

The following request packet creates a backup task for the subscription account with ID 3:

<packet>
<backup-manager>
   <backup-webspace>
      <webspace-id>3</webspace-id>
      <local/>
      <prefix>example-webspace</prefix>
      <description>Standard weekly backup</description>
      <split-size>0</split-size>
   </backup-webspace>
</backup-manager>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <backup-manager>
    <backup-webspace>
      <result>
        <status>ok</status>
        <task-id>23</task-id>
      </result>
    </backup-webspace>
  </backup-manager>
</packet>

Creating task to back up mail accounts

The following request packet creates a backup task which instructs Plesk to back up mail accounts on example.com.

<packet>
<backup-manager>
   <backup-webspace>
      <webspace-name>example.com</webspace-name>
      <remote>ftp</remote>
      <description>Mail accounts backup</description>
      <only-mail/>
   </backup-webspace>
</backup-manager>
</packet>

 Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <backup-manager>
    <backup-webspace>
      <result>
        <status>ok</status>
        <task-id>22</task-id>
      </result>
    </backup-webspace>
  </backup-manager>
</packet>