Using Team City 2017.1.1 (build 46654) I am trying to download artifacts using REST from Powershell on windows 10.
I am using this: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildArtifacts
but I still cannot get it to work. As an example I am trying download the info.txt artifact that I can access using my browser from the below URL:
http://mytc/repository/download/MyBuildConfiguration/294859:id/output/logs/info.txt
Based on: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildArtifacts
I am doing the following from 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
But I get the error:
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
Based on below suggestion I have now tried:
$response = Invoke-WebRequest http://mytc/httpAuth/app/rest/builds/id:294859/artifacts/output/logs/info.txt -Credential $creds
But still get:
Invoke-WebRequest : The remote server returned an error: (404) Not Found.
Any ideas?