Jenkins get list of builds and parameters

I would like to make an API call to Jenkins to fetch a list of builds along with their parameters and status. We currently pass a git commit sha1 as a parameter to build a specific branch. Any ideas how I can get this information easily?

  • How to release automatically your artifact to GitHub
  • How to stop a build in Jenkins via the REST api ?
  • GitHub API V3 : what is the difference between pushed_at and updated_at?
  • Checking if a repo is starred with GitHub API
  • Use Javascript to get the list of a user's Github repositories
  • Get raw file from repository
  • Git can't see files installed by composer
  • Lion OS - brew update returns “Failure while executing…”
  • How to switch from first github account to second?
  • Git log stats with regular expressions
  • how to solve git error while installing linkedin from git://github.com/pengwynn/linkedin.git?
  • Removing unwanted folders from git repo permanently - Repo size not changing
  • 2 Solutions collect form web for “Jenkins get list of builds and parameters”

    Jenkins provides a nice api.

    It is documented at:

    http://$HOST/jenkins/api
    

    You probably want something like:

    http://$HOST/jenkins/api/xml?xpath=/hudson/job[1]/build[1]/action[1]/parameter&depth=2
    

    As far as I know, this can’t be done in a single API call.

    First query all builds.

    /job/<jobname>/api/xml
    /job/<jobname>/api/json
    

    This will return xml or json output, respectively.

    Once you get the build numbers, you can query each build number.

    /job/<jobname>/<jobnum>/api/xml?xpath=/freeStyleBuild/action/lastBuiltRevision/SHA
    /job/<jobname>/<jobnum>/api/json?tree=actions[lastBuiltRevision[SHA]]
    

    Then you can check the SHA in the result against your SHA.

    Git Baby is a git and github fan, let's start git clone.