简体   繁体   中英

Get console output of a jenkins job by sending the build number as a json parameter through api

I'm trying to get the job status by providing the build number as a parameter.

curl -s -S  -u "Ashwin":"XXX" "http://XX.XXX.XXX.XX:8080/job/apitest/buildNum/logText/progressiveText?start=0"

The above snippet work absolutely fine. Is there anyway to send the build number as a json body.

In a word, no. The Jenkins API defines the query for the console log as a GET request, which (at least in the Jenkins API) does not contain a body. The primary parameters like job and build id are part of the URL path, and optional parameters are provided in the query string part of the URL.

This question strikes me as odd. Why can you not construct the query URL (which contains the build id as part of the URL path) in same way that you would construct the JSON structure that you propose sending in the body?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM