Reputation: 4717
Suppose a have a folder named TOPLEVEL
, which contains many jobs inside. I want to be able list all the folders that TOPLEVEL
contains.
I have tried accessing the following json
tree url, but it does not seem to work.
http://jenkins/job/TOPLEVEL//api/json?tree=jobs[name,_class=%22hudson.model.Folder%22]&wrapper=root
It is still giving me stuff like:
{
"_class": "hudson.model.FreeStyleProject",
"name": "testProject1"
}
Nevertheless, it does give me folders, but it also gives me other types of jobs, which I do not want?
{
"_class": "com.cloudbees.hudson.plugins.folder.Folder",
"name": "Github"
}
when I do not require this. Am I doing my API call wrong?
Upvotes: 2
Views: 4322
Reputation: 36
I found this https://gist.github.com/justlaputa/5634984
jenkins_url
+ /api/json?tree=jobs[name,color]
jenkins_url
+ /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]
jenkins_url
+ /job/${job_name}/lastBuild/api/json
jenkins_url
+ /job/${job_name}/lastBuild/api/json?tree=result,timestamp,estimatedDuration
timestamp = start time
estimatedDuration = duration
Upvotes: 2