Get a Database Backup
Use Case
Use the REST API to get a backup of your YouTrack database.
Summary
To get a backup of the YouTrack database:
Get a list of available backups.
If required, create a new backup.
Get the URL of the new backup.
Step-by-Step
Get a list of Available Backups
To get a list of available backups, send a GET request to the database backups endpoint:
In response, you will get a JSON object containing one or more database backups.
Use the following syntax for the request:
Pay attention to the fields
request parameter. It should contain a list of database backup entity attributes, that YouTrack must return in response to your request. If you do not specify any field here, you will get only the entity ID and \$type of each found database backup. Read more about fields syntax in YouTrack REST API.
Sample request
Sample response body
Optional: Create a Fresh Backup
If you wish to create a fresh backup, send a POST request to the following endpoint:
As the payload, send a JSON object backupStatus
instructing the server to initiate the backup.
For instance, the following sample request initiates a new backup:
Pay attention to the headers in the request, and you can also provide a list of attributes in the fields
request parameter to specify the attributes that will help you monitor the backup in the response that the server will return.
To the sample request above, server would return the following data:
Get the link to the backup
After you created a fresh backup, you can send another GET request to read an updated list of the backups.
The most important here is to specify the following attributes in the fields
request parameter: creationDate,link,id
.
For example, we send the following GET request:
In response to such request, the server returns the follwing group of JSON objects, sorted by the creation timestamp in descending order.
So, to download the fresh backup, we how need to take the link
for the first returned backup entity: "link": "backupFile/2020-05-22-13-14-07.tar.gz"
.
To compose the complete download URL, you need to add the link to the baseURL of your youtrack service. In our example, the baseURL
for the service would be https://example.com/youtrack/
. Hence, the complete download URL for the newest database backup file would be: