3

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/
VoiceOfUnreason
  • 52,766
  • 5
  • 49
  • 91
chtenb
  • 14,924
  • 14
  • 78
  • 116
  • So basically you want to make one request and get several files in response? Cannot imagine format of such a response. – cyberskunk Jun 16 '16 at 17:50
  • A zip file would be a decent solution. – chtenb Jun 16 '16 at 18:38
  • 1
    Well, getting zip archive with contents of a folder is not the exactly the same thing as getting directory contents. But you can save directory to a single archive when generating artifacts using `*/*.html => report.zip` syntax. – cyberskunk Jun 16 '16 at 21:20

3 Answers3

5

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

VoiceOfUnreason
  • 52,766
  • 5
  • 49
  • 91
0

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

0

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

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

*.lastfinished or .lastPinned

Amarula
  • 142
  • 1
  • 15