Skip to main content

Restoring from a Backup

Restoring a company from a backup in the REST API

Written by Lenka Haringerová

Getting a backup

You can use the REST API to get a backup of a company as follows:

GET /c/db_nazev/backup
  • if you specify the Accept header, it must have the value application/x-winstrom-backup (or application/octet-stream),

  • the response has Content-Type: application/x-winstrom-backup.

ℹ️ If the Accept header has a different value (e.g. application/json), the server will respond with 406 Not Acceptable.


Restoring from a backup

A company can also be restored from a backup using the REST API:

PUT /c/db_nazev/restore?name=Firma
  • the name parameter is optional — if not specified, the name from the last valid company settings will be used,

  • the request body must contain the company backup,

  • if you specify the Content-Type header, it must have the value application/x-winstrom-backup (or application/octet-stream) — otherwise the server will respond with 415 Unsupported Media Type.

⚠️ The company being restored must not already exist — it will be created during the restore process. If the company already exists, the server will respond with 400 and the message Company 'db_nazev' already exists — the message contains the database identifier from the URL, not the value of the name parameter.

If you use a disallowed character in the company identifier, you will be redirected to the URL with a valid identifier.


Restoring a test company

When restoring from a backup, you can also mark the company as a test company and disable features that are not desirable during testing. The forTesting=1 parameter is used for this purpose:

PUT /c/db_nazev/restore?name=Firma&forTesting=1

In this mode, you can also specify which features should be disabled. By default (if not specified), the parameters have the value 1, which disables the corresponding feature. If you don't want the feature to be disabled, specify the parameter with the value 0.

Features that can be disabled:

disableEet

Disables sending messages to EET. In all validity periods of the company settings, the Communication mode property (on the Automatic operations — EET tab) will be changed to the value Vypnuto.

disableAutoSendMail

Disables automatic sending of emails. In all validity periods of the company settings, the Automatically send documents by email property (on the Other tab) will be changed to the value Neodesílat.

disableWebHooks

Unregisters all Web Hooks registered in the company.

skipZurnal

Optional parameter — do not restore the change history.

skipChangelog

Optional parameter — do not restore the Changes API history.

The URL might then look something like this:

PUT /c/db_nazev/restore?name=Firma&forTesting=1&disableAutoSendMail=0&skipZurnal


Related

Did this answer your question?