How to get the details of the job along with it console output using Jenkins REST API
example of builds
console output:
I am using foll
we can get console log with Above URL mentioned http://localhost:8080/job/Echo/25//consoleText
URL urls = new URL("http://localhost:8080/job/Echo/25//consoleText");
HttpURLConnection connection = (HttpURLConnection) urls.openConnection();
connection.setDoOutput(true);
//connection.setRequestProperty("User-Agent", "Mozilla/5.0");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36");
System.setProperty("http.agent", "Chrome");
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/json");
// Convert to a JSON object to print data
/*HttpServletRequest request;*/
BufferedReader br = new BufferedReader(new InputStreamReader(
(connection.getInputStream())));
it worked for me if any queries please ping me