Visit the latest version of Jenkins API and report error 403 no valid crush was included in the request solution
Using cURL
The following example retrieves a crumb and uses it to build a job calledsomeJob
.
Before 2.176.2, no session required:
# Replace with your Jenkins URL and admin credentials
SERVER="http://localhost:8080"
CRUMB=$(curl -u "admin:admin" "$SERVER"/crumbIssuer/api/xml?xpath=concat\(//crumbRequestField,%22:%22,//crumb\))
curl -X POST -u "admin:admin" -H "$CRUMB" "$SERVER"/job/someJob/build
After 2.176.2, session is required:
# Replace with your Jenkins URL and admin credentials
SERVER="http://localhost:8080"
# File where web session cookie is saved
COOKIEJAR="$(mktemp)"
CRUMB=$(curl -u "admin:admin" --cookie-jar "$COOKIEJAR" "$SERVER/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)")
curl -X POST -u "admin:admin" --cookie "$COOKIEJAR" -H "$CRUMB" "$SERVER"/job/someJob/build
Parameters:
-u "<USERNAME>:<PASSWORD_OR_API_TOKEN>"
-H "<ISSUED_CRUMB_FOR_USER>"
Debugging Issues
I’m seeing the following response:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 400 Nothing is submitted</title>
</head>
<body><h2>HTTP ERROR 400 Nothing is submitted</h2>
<table>
<tr><th>URI:</th><td>/job/CICD_booking_Job/build</td></tr>
<tr><th>STATUS:</th><td>400</td></tr>
<tr><th>MESSAGE:</th><td>Nothing is submitted</td></tr>
<tr><th>SERVLET:</th><td>Stapler</td></tr>
</table>
<hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.27.v20200227</a><hr/>
</body>
</html>
Similar Posts:
- Solution of 405 not allowed error in nginx
- How to Solve Curl pass large JSON files Error
- Solution to the problem that ends with cannot locate in XPath
- How does MAC uninstall Jenkins
- The solution of Jenkins’ error ‘gradle build daemon appeared unexpectedly’
- Document.body.clientheight cannot get the browser page height correctly
- Jenkins – mvn: command not found
- PHP Curl: How to Sending Post JSON Formate Data
- cURL error: name lookup timed out