I know I can call localhost/job/RSpec/lastBuild/api/json
to get the status of the lastest Jenkins build. However, since our build runs very long (a couple hours
To get the last successful build number:
curl --user <userName:password> https://<url>/job/<job-Name>/api/xml?xpath=/*/lastStableBuild/number
Try http://$host/job/$jobname/lastSuccessfulBuild/api/json
Jenkins (and Hudson) expose multiple different builds, such as lastBuild, lastStableBuild, lastSuccessfulBuild, lastFailedBuild, lastUnstableBuild, lastUnsuccessfulBuild, lastCompletedBuild.