How to use query tree parameter in Jenkins Remote API to get downstreamProject and parameter?

I am trying to use the Jenkins (Hudson) Remote API to use the XML response from freeStyleProject.

Exploring the Jenkins tree query parameter documentation and here I tried to use it to improve response time to get an XML response. But Jenkins does not seem to be able to generate the downstreamProject nodes of the job and the assembly action / parameter with this URL:

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

I just get this XML response:

<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> 

Perhaps the tree query parameter does not support them? Will there be the only way to get these nodes using the xpath and exlude request parameters?

+4
source share
1 answer

For the "tree" parameter, the parts you are looking for are plural (where you have singular numbers).

action => actions

parameter => parameters

downstreamProject => downstreamProjects

So your url will be:

HTTP: // local / Work / MyJob / API / XML depth = 2 & tree = name, description, builds [actions [parameters [name, value]], number, URL, timestamp, result], healthReport [rating, description ], downstreamProjects [name, URL]

+10
source

Source: https://habr.com/ru/post/1396652/


All Articles