Tag Archives: Error 403 No valid crumb was included in the request

Visit the latest version of Jenkins API and report error 403 no valid crush was included in the request solution

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>