how to get progress bar data for a running jenkins job through the API

api, jenkins

Solution

Here's the URL that gives me the information I need:

http://<host>/job/<jobname>/lastBuild/api/xml?tree=timestamp,estimatedDuration

Which yields something like:

<freeStyleBuild>
  <estimatedDuration>86126</estimatedDuration>
  <timestamp>1350615637401</timestamp>
</freeStyleBuild>

Problem

I want to use the jenkins API to get information about my current jobs. I can find information on the last build (`.../job/MyJob/lastBuild/api/xml`) but I'm not seeing the field(s) that would let me create a progress bar. I see an `estimatedDuration` field and a `building` field, but nothing that tells me how long it's already been running.

Original source