Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to delete a hudson job programmatically via REST API?

Tags:

hudson

I can create jobs using /createItem?name=JOBNAME, but cant find anything in the docs about deleting jobs.

like image 635
Tom Avatar asked May 23 '11 15:05

Tom


People also ask

How do I delete a Jenkins project?

To delete any job from Gui,Go to your job and on left side,click on delete project. Save this answer.

What is REST API in Jenkins?

The jenkins-rest library is an object oriented Java project that provides access to the Jenkins REST API programmatically to some remote API Jenkins provides. It is built using the jclouds toolkit and can easily be extended to support more REST endpoints.


2 Answers

Discovered by looking into how the delete button does it that you can just post to joburl/doDelete a bit like this..

wget -qO- --post-data="anything" http://HOST/job/JOBNAME/doDelete > /dev/null
like image 152
Tom Avatar answered Oct 24 '22 12:10

Tom


Go to <JobURL>/api/? You will get below text.

Delete a job

To programmatically delete this job, do HTTP POST to this URL.

DISCLAIMER: I tested it with Jenkins. But this should also work in Hudson.

like image 41
Peter Schuetze Avatar answered Oct 24 '22 12:10

Peter Schuetze