Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get build information from jenkins using rest api

I want to retrieve the build summary for last 3 days from Jenkins using its rest API's and save the result as an XML file, How I can proceed with this?

like image 753
Mukul Avatar asked Aug 18 '17 06:08

Mukul


People also ask

How do I get Jenkins build information?

Or if you want to access information about a particular build, e.g. https://ci.jenkins.io/job/Websites/job/jenkins.io/job/master/lastSuccessfulBuild/ , then go to https://ci.jenkins.io/job/Websites/job/jenkins.io/job/master/lastSuccessfulBuild/api/ and you'll see the list of functionalities for that build.

How do I access REST API Jenkins?

The simplest way to access Jenkins REST API is to gather the User Token which is available by selecting your User and clicking on Configure. Now you will use the token as parameter for your authentication.

How can I see my Jenkins details?

From the CI/CD drop-down list, select Jenkins > Jobs. A dashboard show Jenkins job data. For details, see Jenkins > Jobs.


1 Answers

You could read full guide in:

http://YOUR_JENKINS:8080/job/YOUR_JOB/api/

The build sumary in XML format:

http://YOUR_JENKINS:8080/job/YOUR_JOB/api/xml

Retrieve the name of the first 10 builds

http://YOUR_JENKINS:8080/job/YOUR_JOB/api/xml?%20tree=jobs[name]{0,10}
like image 173
Tuan Avatar answered Oct 25 '22 03:10

Tuan