How to get last build date of a job from Jenkins in Java How to get last build date of a job from Jenkins in Java jenkins jenkins

How to get last build date of a job from Jenkins in Java


As Harshavardhan Konakanchi mentioned in his answer there's the /lastBuild/ URL path. You can get exactly the information you want by using:

<JENKINS_URL>/job/<JOB_NAME>/lastBuild/api/json?tree=timestamp

Example output:

{"timestamp":1467898403630}

See <JENKINS_URL>/job/<JOB_NAME>/lastBuild/api/ for a description of the API.


I am not sure whether this could solve you out or not, but here is my workaround

Access url /job/<job_name>/lastBuild/api/json retrieve timestamp

Convert epoch time to required date-time format