您如何使用C#以编程方式从最新的Team City构建中下载工件?
我了解HTTPClient和GET流程。我想在这里找到正确的URL /语法,以使其与Team City一起使用。
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.
我一直在尝试通过示例使它起作用在 RestDocumentation
I've been trying to get this to work using the examples at RestDocumentation
但是,它们都需要一个buildId。这是一个不同的内部版本号,该数字随每个内部版本而变化。我用 buildId = lastSuccesful
尝试了几种组合,但是我似乎无法正确理解语法。我已经能够创建一个链接,将其粘贴到Web浏览器中时成功下载特定的构建,但是,当我尝试以编程方式获取它时,出现了400未经授权的异常。
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.
我在想,在可以使用REST API之前,我需要以某种方式登录Team City吗?
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.
- 以编程方式登录Team City。 (这现在对我有用)
- 获取我的项目的上次成功构建的BuildID。 (帮助!!)
- 下载与上述构建关联的工件。 (这现在对我有用)
在实现上述目标方面,我将不胜感激。
I would greatly appreciate any help in accomplishing the above.
谢谢!!
谢谢黑客使我走上正轨!
Thank you Hackerman for getting me on the right track !!
因此,如果有人感兴趣,这就是答案。
So, if anybody is interested, here's the answer..
- 使用guestAuth代替httpAuth。
-
获取最近成功构建的内部版本号。
http:// yourteamcityserver:8080 / guestAuth / app / rest / buildTypes / id:yourprojectname / builds?count = 1& status = SUCCESS
解析出
希望这可以节省一些人
再次感谢Hackerman !!!!
Thanks again Hackerman !!!!