chtenb
chtenb

Reputation: 16184

TeamCity: Get a whole directory of artifacts using REST API

Using teamcity's REST API it is possible to retrieve a single artifact by URLs of the form

http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/app.exe

How can I obtain an entire directory? The following doesn't work:

http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/

Upvotes: 3

Views: 1606

Answers (3)

Amarula
Amarula

Reputation: 162

I believe this has already been answered on stack. You should use:

GET http://<teamcity>/repository/downloadAll/<buildTypeId>/.lastSuccessful*/files

*.lastfinished or .lastPinned

Upvotes: 0

VoiceOfUnreason
VoiceOfUnreason

Reputation: 57194

From TCD9/REST API

GET http://teamcity:8111/httpAuth/app/rest/builds/<build_locator>/artifacts/archived/<path>?locator=pattern:<wildcard> 

(returns the archive containing the list of artifacts under the path specified. The optional locator parameter can have file to limit the files only to those matching the wildcard) Media-Type: application/zip

Upvotes: 5

Jonathan King
Jonathan King

Reputation: 142

Generally if it's a rest API it will follow certain conventions, ie:

GET /books/15 -> returns the book with id 15

GET /books -> returns an array of available books

POST /books/15 -> updates the book with id 15

etc.

It really depends on the implementation of the API, though.

Sometimes you can also get a list of files on a server by default via a GET request, but that depends on the security settings of the webserver. Most don't allow for directory listing by default.

You could try these:

GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files

GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts

Upvotes: 0

Related Questions