【发布时间】:2017-07-24 22:11:40
【问题描述】:
使用 Team City 2017.1.1(内部版本 46654)我正在尝试使用 REST 从 Windows 10 上的 Powershell 下载工件。
我正在使用这个: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildArtifacts
但我仍然无法让它工作。例如,我正在尝试从以下 URL 下载我可以使用浏览器访问的 info.txt 工件:
http://mytc/repository/download/MyBuildConfiguration/294859:id/output/logs/info.txt
基于: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildArtifacts
我正在通过 Powershell 执行以下操作:
$TeamCityUser = 'tcuser'
$TeamCityPassword = 'tcpass'
$securePassword = ConvertTo-SecureString $TeamCityPassword -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential($TeamCityUser, $securePassword)
$response = Invoke-WebRequest http://mytc/httpAuth/app/rest/builds/294859:id/artifacts/output/logs/info.txt -Credential $creds
但我得到了错误:
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
根据我现在尝试的以下建议:
$response = Invoke-WebRequest http://mytc/httpAuth/app/rest/builds/id:294859/artifacts/output/logs/info.txt -Credential $creds
但仍然得到:
Invoke-WebRequest : The remote server returned an error: (404) Not Found.
有什么想法吗?
【问题讨论】:
-
你看到this的答案了吗?
标签: rest powershell teamcity powershell-4.0