I understand the HTTPClient and GET process. What I'm trying to find here is the correct URL/syntax to make this work with Team City.
I've been trying to get this to work using the examples at RestDocumentation
However, they all require a buildId. This is a distinct build number which changes with each build. I've tried several combinations with buildId=lastSuccesful
but I just can't seem to get the syntax correct. I have been able to create a link that successfully downloads a specific build when pasted into a web browser, however, when I try to get it programatically, I get a 400 Unauthorized exception.
I'm thinking that before I can use the REST API, I need to somehow log in to Team City?
Anyway, this is probably quite a simple operation, I just don't seem to be able to decipher the steps to perform it.
So, here's the steps I think need to happen, but I have no Idea how to accomplish them.
- Programatically log into Team City. (This is now working for me)
- Get the BuildID of the last successfull build for my project. (HELP !!)
- Download the artifacts associated with the above build. (This is now working for me)
I would greatly appreciate any help in accomplishing the above.
Thanks !!
Thank you Hackerman for getting me on the right track !!
So, if anybody is interested, here's the answer..
Get the build number of the latest successful build. http://yourteamcityserver:8080/guestAuth/app/rest/buildTypes/id:yourprojectname/builds?count=1&status=SUCCESS
Parse out the build number from the XML you receive back.
Hope this saves some of you the hours I spent figuring out how this all works.
Thanks again Hackerman !!!!