使用cURL命令触发我的Jenkins构建作业

使用cURL命令触发我的Jenkins构建作业,curl,jenkins,triggers,unauthorized,Curl,Jenkins,Triggers,Unauthorized,我想使用cURL.exe触发我的jenkins构建,我尝试使用以下命令: curl -k -X POST -u username:APItoken https://Jenkins_URL/view/All/job/JobName/build 但我面临的问题如下: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" <html><head> <title>401 Unauthorized</title

我想使用cURL.exe触发我的jenkins构建,我尝试使用以下命令:

curl -k -X POST -u username:APItoken https://Jenkins_URL/view/All/job/JobName/build
但我面临的问题如下:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>

当我尝试提供适当的API令牌时,上述问题得到了解决。因为在我的场景中,有2个Jenkins A和B。在试图执行Jenkins B中存在的构建作业时,我错误地提供了Jenkins A的API令牌

这就是我面临“未经授权”问题的原因