Jenkins RestAPI call with Error 403 No valid crumb was included in the request
方法一:禁用跨站
在jenkins 的Configure Global Security下 , 取消“防止跨站点请求伪造(Prevent Cross Site Request Forgery exploits)”的勾选
方法二:带CRUMB请求
1、获取用户API token
点击 show API Token,假设是API_TOKEN
2、计算CRUMB
CRUMB=$(curl -s 'http://USER:[email protected]_IP:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
3、请求时附带CRUMB信息即可
curl -X POST -H "$CRUMB" http://USER:[email protected]_IP:8080/reload
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here