如何在Jenkins Remote API中使用树形查询参数来获取下游项目和参数?

Gha*_*ost 4 hudson hudson-api jenkins

我正在尝试使用Jenkins(Hudson)远程API来使用freeStyleProject的XML响应.

研究关于詹金斯在树中的查询参数文件这里我一直在试图用它来提高响应时间,以获得XML响应.但Jenkins似乎无法使用此URL生成作业的节点downstreamProject和构建的action/parameter:

http:// localhost/job/MyJob/api/xml?depth = 2&tree = name,description,builds [ action [parameter [name,value] ] number,url,timestamp,result],healthReport [score,description],downstreamProject [名称,网址]

我只是得到这个响应XML:

<freeStyleProject>
    <description>Description</description> 
    <name>MyJob</name> 
    <build>
        <number>2</number> 
        <result>SUCCESS</result> 
        <timestamp>1325784290000</timestamp> 
        <url>http://localhost/job/MyJob/2/</url> 
    </build>
    <build>
      <number>1</number> 
      <result>SUCCESS</result> 
      <timestamp>1323931754000</timestamp> 
      <url>http://localhost/job/MyJob/1/</url> 
    </build>
    <healthReport>
       <description>Build stability: No recent builds failed.</description> 
       <score>100</score> 
    </healthReport>
</freeStyleProject>
Run Code Online (Sandbox Code Playgroud)

也许树查询参数不支持这些?使用xpath和exlude查询参数获取此节点的唯一方法是什么?

小智 10

对于"树"参数,您要查找的部分是复数(您可以使用单面).

action => actions

parameter =>参数

downstreamProject => downstreamProjects

所以,你的网址是:

HTTP://本地主机/工作/ MyJob/API/xml的深度= 2&树=名称,描述,构建[动作[参数[名称,值],号码,URL,时间戳,结果],healthReport [得分,说明], downstreamProjects [名称,网址]