YouTrack Standalone 2018.3 Help

Database Backup

The two REST API resources that are described here let you manage the backups of your YouTrack database.

Resource

/api/admin/databaseBackup/

Returned entity

This root resource does not return any entity. This is a common ancestor for two sub-resources that actually return entities and let you operate backup settings and files.

Sub-resources

List of Backups

Resource

/api/admin/databaseBackup/backups

Returned entity

BackupFile. For description of the entity attributes, see the Supported Fields section.

Supported methods

Supported Fields

This table describes attributes of the BackupFile entity.

  • To receive an attribute in the response from server, specify it explicitly in the fields parameter of a request.

Field

Type

Description

creationDate

Long

Stores the timestamp of the moment when the backup file was created.

error

String?

Stores the error message that is returned in the case of backup failure.

file

java.io.File

Stores the pathname of the backup file.

id

string

Stores an entity ID of the backup file.

link

string

Stores a download URL for the backup file.

name

string

Stores the name of the backup file.

size

string

Stores the size of the backup file.

Read the List of Backup Files

Request syntax

GET /api/admin/databaseBackup/backups[?fields=<fields>

Request parameters:

Parameter

Type

Description

fields

string

A list of fields that should be returned in the response. If no fields specified, only the entity ID is returned.

Sample request

curl -X GET \ 'https://example.myjetbrains.com/youtrack/api/admin/databaseBackup/backups?fields=creationDate,file,error,link,name,size,id' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer perm:am9obi5kb2U=.UG9zdG1hbiBKb2huIERvZQ==.jJe0eYhhkV271j1lCpfknNYOEakNk7' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json'

Sample response body

[ { "name": "2018-09-05-22-27-16.tar.gz", "size": 9291043, "creationDate": 1536175642000, "link": "backupFile/2018-09-05-22-27-16.tar.gz", "file": "/mnt/disk0/example/backup/2018-09-05-22-27-16.tar.gz", "error": null, "id": "2018-09-05-22-27-16.tar.gz" } ]

Database Backup Settings

Resource:

/api/admin/databaseBackup/settings/

Returned entity

DatabaseBackupSettings

Supported methods

Supported fields

This table describes attributes of the DatabaseBackupSettings entity.

  • To receive an attribute in the response from server, specify it explicitly in the fields parameter of a request.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

archiveFormat

BackupFileType

Stores the current selected format of backup files. Supported values are TAR_GZ or ZIP.

availableDiskSpace

Long

Read-only. Stores the size of available disk space.

backupStatus

BackupStatus

Stores the current status of the backup.

cronExpression

String

Stores the cron expression that defines the schedule of regular backup.

defaultLocation

String

Default location of the backups storage.

filesToKeep

Int

Stores a number of backup files that should be stored.

isOn

Boolean

When true, the automatic regular backup is enabled. Otherwise, automatic backup is disabled.

location

String

Stores the actual location of the backups storage folder.

notifiedUsers

Iterable<User>

Stores a list of users who get notifications about backup failures.

id

String

Stores entity ID of the DatabaseBackupSettings.

Read Backup Settings

Request syntax:

GET /api/admin/databaseBackup/settings?[fields=<fields>]

Request parameters:

Parameter

Type

Description

fields

string

A list of DatabaseBackupSettings attributes that should be returned in the response body. If no fields specified, only entity ID is returned.

Sample request

curl -X GET \ 'https://example.myjetbrains.com/youtrack/api/admin/databaseBackup/settings?fields=archiveFormat,availableDiskSpace,backupStatus%28backupCancelled,backupError%28date,errorMessage%29,backupInProgress,stopBackup%29' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer perm:am9obi5kb2U=.UG9zdG1hbiBKb2huIERvZQ==.jJe0eYhhkV271j1lCpfknNYOEakNk7' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json'

Sample response body

{ "archiveFormat": "TAR_GZ", "backupStatus": { "backupInProgress": false, "stopBackup": false, "backupError": null, "backupCancelled": false }, "availableDiskSpace": 163780067328 }

Update Backup Settings

Request syntax:

POST /api/admin/databaseBackup/settings?[fields=<fields>]

Request parameters:

Parameter

Type

Description

fields

string

A list of DatabaseBackupSettings attributes that should be returned in the response body. If no fields specified, only entity ID is returned.

The following sample request updates the backup file format, enables regular backup, updates the backup interval, sets the number of backups to keep, and adds a user to the list of those who get notifications about backup failures.

curl -X POST \ 'http://youtrack.example.com/api/admin/databaseBackup/settings?fields=archiveFormat,availableDiskSpace,backupStatus%28backupCancelled,backupError%28date,errorMessage%29,backupInProgress,stopBackup%29,isOn,filesToKeep,cronExpression,notifiedUsers%28id,name,login%29' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer perm:YWRtaW4=.UG9zdG1hbiBuZXc=.SQi7S1GqrZpMjvVfv523Aazln3pyYI' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "archiveFormat": "TAR_GZ", "notifiedUsers":[{"id":"24-0"}], "isOn":true, "cronExpression":"0 0 2 * * ?", "filesToKeep":30 }'

Sample response body

In response to the sample request, the server sends the following data in the response body:

{ "isOn": true, "archiveFormat": "TAR_GZ", "filesToKeep": 30, "availableDiskSpace": 70264000512, "notifiedUsers": [ { "name": "TARDIS", "login": "admin", "id": "24-0" } ], "backupStatus": { "backupInProgress": false, "stopBackup": false, "backupCancelled": false, "backupError": null }, "cronExpression": "0 0 2 * * ?" }
Last modified: 7 March 2019