Get build details for all builds of all jobs from Jenkins REST API Get build details for all builds of all jobs from Jenkins REST API jenkins jenkins

Get build details for all builds of all jobs from Jenkins REST API


In case, anyone else is stuck with the same, I was able to get this done using the tree:

https://<JENKINS_HOST>/api/json?tree=jobs[name,url,builds[number,result,duration,url]]

Here, column names can be filtered to fetch only the data you need as the amount of data returned from this is huge.

You can also limit the number of records to be fetched like this:

https://<JENKINS_HOST>/api/json?tree=jobs[name,url,builds[number,result,duration,url]{0,50}]

This will fetch only the last 50 builds for all the jobs, which is exactly what I needed.