Reputation: 2937
I read the following post which does what I want for all jobs (and I made it works)
List all keep-forever builds in Jenkins?
here is what I have now : http://jenkinsmediaprocessor:7880/api/xml?depth=2&xpath=/hudson/job/build[keepLog=%22true%22]/url&wrapper=forever
But I only want to display a specific task. However I don't know where to set the job name,
I tried the followings
1-) job/MYJOBNAME
2-) JOBPATH/job/MYJOBNAME
3-) replace job with MYJOBNAME
I can't make it works.
Also would it be possible to only display a list of number? Instead of having to use a grep on the *.xml.
Upvotes: 4
Views: 2271
Reputation: 7326
This works for me:
JENKINS_URL/job/JOB_NAME/api/xml?depth=2&xpath=//build[keepLog=%22true%22]/number&wrapper=forever
Sample output:
<forever>
<number>688</number>
<number>687</number>
</forever>
forever
is a wrapper parameter. You will find more details if refer to JENKINS_URL/api
:
For XPath that matches multiple nodes, you need to also specify the "wrapper" query parameter to specify the name of the root XML element to be created so that the resulting XML becomes well-formed.
Upvotes: 9