简体   繁体   English

TeamCity:使用REST API获取工件的完整目录

[英]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 使用teamcity的REST API,可以通过以下形式的URL检索单个工件

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/

From TCD9/REST API 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 (返回包含指定路径下的工件列表的存档。可选的locator参数可以具有文件,以将文件限制为仅与通配符匹配的文件)媒体类型:application / zip

Generally if it's a rest API it will follow certain conventions, ie: 通常,如果它是re​​st API,它将遵循某些约定,即:

GET /books/15 -> returns the book with id 15 GET /books/15 >返回ID为15的书

GET /books -> returns an array of available books GET /books >返回可用书籍的数组

POST /books/15 -> updates the book with id 15 POST /books/15 >更新ID为15的书

etc. 等等

It really depends on the implementation of the API, though. 不过,这实际上取决于API的实现。

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. 有时,默认情况下,您还可以通过GET请求获得服务器上文件的列表,但这取决于Web服务器的安全设置。 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

I believe this has already been answered on stack. 我相信这已经在堆栈上得到了解答。 You should use: 您应该使用:

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

*.lastfinished or .lastPinned * .lastfinished或.lastPinned

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM