0
votes

I found plenty of information and example about triggering TeamCity 8.1.2 backups via the REST API.

But leaving the backup files on the same server is pretty useless for disaster recovery.

So I'm looking for a way to copy over the generated backup file to another location.

My question is about finding the name of the latest available backup file via the REST API - The Web GUI includes this information under "Last Backup Report" under the "Backup" page of the Server Administration.

I've dug through https://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-DataBackup and the /httpAuth/app/rest/application.wadl on my server. I didn't find any mention of a way to get this info through the REST API.

I also managed to trigger a backup with a hope that perhaps the response gives this information, but it's not there - the response body is empty and the headers don't include this info.

Right now I intend to fetch the HTML page and extract this information from there, but this feels very hackish and fragile (the structure of the web page could change any time).

Is there a recommended way to get this information automatically?

Thanks.

1

1 Answers

0
votes

JetBrains support got back to me with the right answer - I should use a POST method, not GET, even if the request body is empty.

Here is an example of a working request:

curl -u user:password --request POST http://localhost:8111/httpAuth/app/rest/server/backup?includeConfigs=true'&'includeDatabase=true'&'fileName=testBackup

And the response to that contains a plain file name in text: testBackup_20150108_141924.zip