Konsole: backups
Als Markdown kopierenDiese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als Authorization: Bearer ndt_...; siehe API-Tokens. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.
Full backups, the backup schedule and restores.
Download a full backup of the server (use --output). It holds the password hashes and the API key: keep it safe.
Only a super admin may download it. Answers a .tar.gz archive with the database, the keys and the uploaded files; with format=json a settings snapshot instead (settings, branding, folders, groups, users and address books). The download goes into the audit log.
Needs server.config. neodesk backups download calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
format |
query | string, one of json |
json for the settings snapshot |
200: The backup file, named in Content-Disposition (application/gzip, application/json)
String (binary).
The settings snapshot, with format=json
Object.
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, or is not a super admin: a full backup holds every secret of the server |
Check that the backup destination can be written.
Only a super admin may run it. Creates the folder when needed, writes a small file there and removes it again. Reads the destination from the body, not from the saved schedule.
Needs server.config. neodesk backups destination-test calls it.
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
destinationType |
string, one of local, path |
|
destinationPath |
string | An absolute folder, for the path type |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.valid |
true |
yes | |
data.destination |
string | yes | The folder that was written to |
| Error | When |
|---|---|
| 400 | The folder is not usable or can't be written |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, or is not a super admin: a full backup holds every secret of the server |
Show how many update backups are kept.
Reads the saved value, else BACKUP_RETENTION_COUNT, else 0, which keeps all.
Needs server.config. neodesk backups retention calls it.
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.count |
integer | yes |
data.source |
string, one of database, environment, unset |
yes |
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
Set how many update backups are kept (0 keeps all).
Logs the change in the audit log.
Needs server.config. neodesk backups retention-set calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
count |
integer | yes | How many update backups to keep; 0 keeps all; at least 0, at most 1000 |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.count |
integer | yes |
| Error | When |
|---|---|
| 400 | count is not a whole number from 0 to 1000 |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
Show the backup schedule and destination.
next.at is null while the schedule is off; a time of day is read in the server's time zone.
Needs server.config. neodesk backups schedule calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.schedule |
BackupSchedule | yes | |
data.status |
BackupScheduleStatus | yes | |
data.next |
object | yes | |
data.next.at |
string or null (date-time) | yes | |
data.next.timeZone |
string | yes | The server's time zone, like Europe/Berlin |
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
Set the backup schedule and destination.
Only a super admin may change it. Fields left out take their defaults.
Needs server.config. neodesk backups schedule-set calls it.
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
enabled |
boolean | Turn scheduled backups on or off |
intervalHours |
integer | Hours between backups, rounded and held between 1 and 720; default 24, at least 1, at most 720 |
retentionCount |
integer | How many backups to keep: a whole number from 1 to 365; default 7, at least 1, at most 365 |
destinationType |
string, one of local, path |
Anything but path is local; default "local" |
destinationPath |
string | An absolute folder, not the file system root, for the path type |
timeOfDay |
string | HH:MM, kept only when intervalHours is a whole number of days |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
BackupSchedule | yes |
| Error | When |
|---|---|
| 400 | retentionCount is not a whole number from 1 to 365, or the path is not usable |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, or is not a super admin: a full backup holds every secret of the server |
Make a backup now, to the scheduled destination.
Only a super admin may run it. Writes a full backup now, whatever the schedule says, checks it, writes its SHA-256 next to it, deletes the oldest backups beyond the retention count and logs it in the audit log. Takes no body.
Needs server.config. neodesk backups run calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.filename |
string | yes | |
data.sha256 |
string | yes | |
data.validation |
object | yes | The check of the archive after it was written |
data.validation.valid |
boolean | ||
data.validation.sizeBytes |
integer | ||
data.validation.components |
array of string | The parts found in the archive | |
data.deleted |
array of string | yes | The old backups deleted |
| Error | When |
|---|---|
| 400 | A scheduled backup is running already, or the backup failed |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, or is not a super admin: a full backup holds every secret of the server |
Show the last and next scheduled backup.
Needs server.config. neodesk backups schedule-status calls it.
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
BackupScheduleStatus | yes |
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
Show what a full backup would hold and how big it is.
Needs server.config. neodesk backups stats calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.users |
integer | ||
data.settings |
integer | ||
data.folders |
integer | ||
data.userGroups |
integer | ||
data.deviceGroups |
integer | ||
data.strategies |
integer | ||
data.addressBooks |
integer | ||
data.backend |
"neodesk" |
yes | |
data.dbType |
string | yes | |
data.components |
object | yes | Which files exist. The older form of parts |
data.components.env |
boolean | ||
data.components.sessionSecret |
boolean | ||
data.components.consoleDb |
boolean | ||
data.components.uploads |
integer | Uploaded files | |
data.components.goPrivKey |
boolean | ||
data.components.goPubKey |
boolean | ||
data.components.goApiKey |
boolean | ||
data.components.goDb |
boolean | ||
data.components.meshAgentCert |
boolean | ||
data.parts |
array of object | yes | What a backup made now holds, part by part |
data.parts[].id |
string, one of database, server_data, database_file, env, session_secret, server_keys, mesh_cert, uploads, chat_files, attachments, fonts, public_endpoints, tls |
yes | |
data.parts[].included |
boolean | yes | Whether a backup made now holds at least one file of it |
data.parts[].reason |
string, one of docker, environment, postgres, not_configured, no_server, empty, missing |
Why it is left out; absent when the part is included | |
data.parts[].files |
integer | yes | |
data.parts[].secret |
boolean | yes | The part holds keys, passwords or their hashes |
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
Restore a backup file. Replaces the current data.
Only a super admin may restore. Takes a multipart form with the file in the field backup, at most 200 MB, and the parts to restore as text fields "true" or "false". A gzip file is a full backup: restoreDatabase and restoreUploads are on unless "false", restoreSecrets, restoreEnv and restoreGoDb off unless "true". Anything else is read as a settings snapshot: restoreUsers is off unless "true", the other parts on unless "false". The restore runs to its end even when the caller goes away, for at most 30 minutes, and goes into the audit log.
Needs server.config. neodesk backups restore calls it. It cannot be undone.
Request body, multipart/form-data:
| Field | Type | Required | What it is |
|---|---|---|---|
backup |
string (binary) | yes | The backup file: a .tar.gz full backup or a JSON settings snapshot |
restoreDatabase |
string, one of true, false |
||
restoreUploads |
string, one of true, false |
||
restoreSecrets |
string, one of true, false |
||
restoreEnv |
string, one of true, false |
||
restoreGoDb |
string, one of true, false |
||
restoreSettings |
string, one of true, false |
||
restoreBranding |
string, one of true, false |
||
restoreUsers |
string, one of true, false |
||
restoreFolders |
string, one of true, false |
||
restoreGroups |
string, one of true, false |
||
restoreAddressBooks |
string, one of true, false |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.type |
string, one of full, config |
yes | |
data.restored |
array of string | yes | |
data.skipped |
array of string | yes | |
data.warnings |
array of string | yes | |
data.requiresRestart |
boolean | Full backups only: restart the server to finish | |
data.backupDate |
string or null (date-time) | Settings snapshots only: when the snapshot was made | |
data.backupVersion |
string | Settings snapshots only: the console version that made it |
| Error | When |
|---|---|
| 400 | No file, a file named .gz that is no gzip file, a backup that is not valid, or the restore failed |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not do this, or is not a super admin: a full backup holds every secret of the server |
| 413 | The file is over 200 MB |