Search code examples
timebuildjenkinsremote-accesstrend

Jenkins—get "Build Time Trend" values using "Remote Access API"


Is there a way that we can get all Jenkins-"Build Time Trend" information ( Build number + Status[success/failed etc] + Duration ) for an application; using the Jenkins remote access API?

Or else I would appreciate if you could post a link of any documentation on how to get information from Jenkins using the Remote Access API. Most of the sources consist of the way of running jobs, but I couldn't find any, which shows how to fetch information from jenkins.

Thanks!


Solution

  • You can use something like this URL:

    http://jenkins:8080/job/MY-APPLICATION/api/json?tree=builds[number,id,timestamp,result,duration]
    

    There's a little more documentation in the root api element:

    http://jenkins:8080/job/MY-APPLICATION/api
    

    I admit to not completely understanding the tree parameter. I couldn't find a simple example of retrieving the entire builds subtree.