2019-06-04 18:33:12 +03:00
Backup Protocol
===============
2023-11-24 20:43:43 +03:00
`Proxmox Backup`_ Server uses a REST-based API. While the management
2021-10-27 17:19:27 +03:00
interface uses normal HTTP, the actual backup and restore interface uses
2021-02-27 14:44:03 +03:00
HTTP/2 for improved performance. Both HTTP and HTTP/2 are well known
2021-10-27 17:19:27 +03:00
standards, so the following section assumes that you are familiar with
2021-02-27 14:44:03 +03:00
how to use them.
2019-11-22 08:59:37 +03:00
2021-02-27 14:44:03 +03:00
Backup Protocol API
-------------------
To start a new backup, the API call `` GET /api2/json/backup `` needs to
be upgraded to a HTTP/2 connection using
2021-10-27 17:19:27 +03:00
`` proxmox-backup-protocol-v1 `` as the protocol name::
2021-02-27 14:44:03 +03:00
GET /api2/json/backup HTTP/1.1
UPGRADE: proxmox-backup-protocol-v1
2021-10-27 17:19:27 +03:00
The server replies with the `` HTTP 101 Switching Protocol `` status code,
and you can then issue REST commands on the updated HTTP/2 connection.
2021-02-27 14:44:03 +03:00
2021-02-28 11:07:13 +03:00
The backup protocol allows you to upload three different kind of files:
- Chunks and blobs (binary data)
2021-10-27 17:19:27 +03:00
- Fixed indexes (List of chunks with fixed size)
2021-02-28 11:07:13 +03:00
2021-10-27 17:19:27 +03:00
- Dynamic indexes (List of chunks with variable size)
2021-02-28 11:07:13 +03:00
2021-10-27 17:19:27 +03:00
The following section provides a short introduction on how to upload such
2021-02-28 11:07:13 +03:00
files. Please use the `API Viewer <api-viewer/index.html> `_ for
2021-10-27 17:19:27 +03:00
details about the available REST commands.
2021-02-28 11:07:13 +03:00
Upload Blobs
~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Blobs are uploaded using `` POST /blob `` . The HTTP body contains the
data encoded as :ref: `Data Blob <data-blob-format>` .
2021-02-28 11:07:13 +03:00
2021-10-27 17:19:27 +03:00
The file name must end with `` .blob `` , and is automatically added
to the backup manifest, following the call to `` POST /finish `` .
2021-02-28 11:07:13 +03:00
Upload Chunks
~~~~~~~~~~~~~
Chunks belong to an index, so you first need to open an index (see
below). After that, you can upload chunks using `` POST /fixed_chunk ``
and `` POST /dynamic_chunk `` . The HTTP body contains the chunk data
2021-02-28 12:32:56 +03:00
encoded as :ref: `Data Blob <data-blob-format>` ).
2021-02-28 11:07:13 +03:00
Upload Fixed Indexes
~~~~~~~~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Fixed indexes are used to store VM image data. The VM image is split
2021-02-28 11:07:13 +03:00
into equally sized chunks, which are uploaded individually. The index
2021-10-27 17:19:27 +03:00
file simply contains a list of chunk digests.
2021-02-28 11:07:13 +03:00
2021-10-27 17:19:27 +03:00
You create a fixed index with `` POST /fixed_index `` . Then, upload
2021-02-28 11:07:13 +03:00
chunks with `` POST /fixed_chunk `` , and append them to the index with
`` PUT /fixed_index `` . When finished, you need to close the index using
`` POST /fixed_close `` .
The file name needs to end with `` .fidx `` , and is automatically added
2021-10-27 17:19:27 +03:00
to the backup manifest, following the call to `` POST /finish `` .
2021-02-28 11:07:13 +03:00
Upload Dynamic Indexes
~~~~~~~~~~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Dynamic indexes are used to store file archive data. The archive data
2021-02-28 11:07:13 +03:00
is split into dynamically sized chunks, which are uploaded
2021-10-27 17:19:27 +03:00
individually. The index file simply contains a list of chunk digests
2021-02-28 11:07:13 +03:00
and offsets.
2021-10-27 17:19:27 +03:00
You can create a dynamically sized index with `` POST /dynamic_index `` . Then,
2021-02-28 11:07:13 +03:00
upload chunks with `` POST /dynamic_chunk `` , and append them to the index with
`` PUT /dynamic_index `` . When finished, you need to close the index using
`` POST /dynamic_close `` .
2021-10-27 17:19:27 +03:00
The filename needs to end with `` .didx `` , and is automatically added
to the backup manifest, following the call to `` POST /finish `` .
2021-02-28 11:07:13 +03:00
Finish Backup
~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Once you have uploaded all data, you need to call `` POST /finish `` . This
commits all data and ends the backup protocol.
2021-02-27 14:44:03 +03:00
Restore/Reader Protocol API
---------------------------
To start a new reader, the API call `` GET /api2/json/reader `` needs to
be upgraded to a HTTP/2 connection using
`` proxmox-backup-reader-protocol-v1 `` as protocol name::
GET /api2/json/reader HTTP/1.1
UPGRADE: proxmox-backup-reader-protocol-v1
2021-10-27 17:19:27 +03:00
The server replies with the `` HTTP 101 Switching Protocol `` status code,
2021-02-28 11:07:13 +03:00
and you can then issue REST commands on that updated HTTP/2 connection.
2021-10-27 17:19:27 +03:00
The reader protocol allows you to download three different kinds of files:
2021-02-28 11:07:13 +03:00
- Chunks and blobs (binary data)
2021-10-27 17:19:27 +03:00
- Fixed indexes (list of chunks with fixed size)
2021-02-28 11:07:13 +03:00
2021-10-27 17:19:27 +03:00
- Dynamic indexes (list of chunks with variable size)
2021-02-27 14:44:03 +03:00
2021-10-27 17:19:27 +03:00
The following section provides a short introduction on how to download such
2021-02-28 11:07:13 +03:00
files. Please use the `API Viewer <api-viewer/index.html> `_ for details about
2021-10-27 17:19:27 +03:00
the available REST commands.
2021-02-28 11:07:13 +03:00
Download Blobs
~~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Blobs are downloaded using `` GET /download `` . The HTTP body contains the
2021-02-28 12:32:56 +03:00
data encoded as :ref: `Data Blob <data-blob-format>` .
2021-02-28 11:07:13 +03:00
Download Chunks
~~~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Chunks are downloaded using `` GET /chunk `` . The HTTP body contains the
data encoded as :ref: `Data Blob <data-blob-format>` .
2021-02-28 11:07:13 +03:00
Download Index Files
~~~~~~~~~~~~~~~~~~~~
2021-10-27 17:19:27 +03:00
Index files are downloaded using `` GET /download `` . The HTTP body
2021-02-28 13:12:31 +03:00
contains the data encoded as :ref: `Fixed Index <fixed-index-format>`
or :ref: `Dynamic Index <dynamic-index-format>` .