我可以用Python做但不能用Curl做...
$ curl -H "Content-Type: application/json; charset=UTF-8" --data-urlencode \
'{ "description": "This is a test job.", "displayName": "#30: Success" }' \
-n http://localhost/job/playground/30/configSubmit
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /job/playground/30/configSubmit. Reason:
<pre> Nothing is submitted</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
答案 0 :(得分:0)
我为此苦了几个小时。最终,this answer to a similar question令我困惑。
Jenkins似乎期望表单数据中包含一个名为json
的字段。最终对我有用的curl命令是
curl -X POST -F 'json={"displayName":"name","description":"a short description"}' \
http://localhost/job/playground/30/configSubmit