Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create folder in Jenkins UI using cURL

I wanted to create a folder for my particular release using curl.

Anyone have tried it ? I used the following command, and that doesn't works for me.

curl -X POST http://MyJenkinsURL/createItem?name=TestingFolder --user MyUsername:API token -H Content-Type:application/x-www-form-urlencoded

If any modifications has to be done for the same command to work or some other commands, please feedback. Thanks in advance.

like image 487
user2561288 Avatar asked Dec 10 '25 06:12

user2561288


1 Answers

You need to tell jenkins to use the Folder plugins to do that

curl -XPOST 'http://jenkins/createItem?name=FolderName&mode=com.cloudbees.hudson.plugins.folder.Folder&from=&json={"name":"FolderName","mode":"com.cloudbees.hudson.plugins.folder.Folder","from":"","Submit":"OK"}&Submit=OK' --user user.name:YourAPIToken -H "Content-Type:application/x-www-form-urlencoded"

Here are some samples using jenkins api to manipulate jobs and folders using curl.

like image 194
Joao Vitorino Avatar answered Dec 12 '25 04:12

Joao Vitorino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!