TeamCity:使用 REST API 获取整个工件目录
TeamCity: Get a whole directory of artifacts using REST API
使用 teamcity 的 REST API 可以通过
形式的 URL 检索单个工件
http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/app.exe
如何获取整个目录?以下无效:
http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/
一般来说,如果是休息API,它会遵循一定的约定,即:
GET /books/15
-> returns id 为 15 的书
GET /books
-> returns 一组可用书籍
POST /books/15
-> 更新 id 为 15
的书
等等
不过,这实际上取决于 API 的实施。
有时您也可以通过 GET 请求默认获取服务器上的文件列表,但这取决于网络服务器的安全设置。默认情况下,大多数不允许目录列表。
你可以试试这些:
GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files
GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts
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
我相信这已经在堆栈中得到了解答。
你应该使用:
GET http://<teamcity>/repository/downloadAll/<buildTypeId>/.lastSuccessful*/files
*.lastfinished 或 .lastPinned
使用 teamcity 的 REST API 可以通过
形式的 URL 检索单个工件http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/app.exe
如何获取整个目录?以下无效:
http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files/bin/
一般来说,如果是休息API,它会遵循一定的约定,即:
GET /books/15
-> returns id 为 15 的书
GET /books
-> returns 一组可用书籍
POST /books/15
-> 更新 id 为 15
等等
不过,这实际上取决于 API 的实施。
有时您也可以通过 GET 请求默认获取服务器上的文件列表,但这取决于网络服务器的安全设置。默认情况下,大多数不允许目录列表。
你可以试试这些:
GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts/files
GET http://myserver.com/httpAuth/app/rest/builds/id:85755/artifacts
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
我相信这已经在堆栈中得到了解答。 你应该使用:
GET http://<teamcity>/repository/downloadAll/<buildTypeId>/.lastSuccessful*/files
*.lastfinished 或 .lastPinned