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 create a new source code branch using TFS API?
  • how to get progress bar data for a running jenkins job through the API
  • Creating a fork with the GitHub V3 API (REST)
  • Is it possible to get github wiki content by github api
  • Getting all versions of a file using GitHub blob api
  • Bitbucket REST interface and GIT; how to get a log history between two tags from a branch
  • Re-doing a reverted merge in Git
  • How can I have github do PR merges with a specific email/user info?
  • Why do merge conflicts happen?
  • Why is Github asking for username/password when following the instructions on screen and pushing a new repo?
  • How to remotely trigger Jenkins multibranch pipeline project build?
  • How to track revision history of revision history?
  • 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.