0

Im trying to create a Jenkins job from the terminal

I downloaded the config file of another project without issues

curl -X GET --user <username>:<api-token>/ http://<jenkins-server-address>:<port>/job/<job-name>/config.xml -o mylocalconfig.xml

the to create the job

curl -s -X POST --user <username>:<api-token> 'http://<jenkins-server-address>:<port>/job/createItem?name=<job-name>' --data-binary @mylocalconfig.xml -H "Content-Type:text/xml"

But I'm getting a 404

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/job/watchlist-app/job/createItem</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>Stapler</td></tr>
</table>
<hr/><a href="https://eclipse.org/jetty">Powered by Jetty:// 10.0.11</a><hr/>

I rember to do in this way a few months ago without issues I don't what's wrong do I missing something?

create a jenkins job from the cli interacting with the jenkins rest api

0 Answers0