0

I am somewhat new to using API's. In the below question, the answer mentions using the http://<MY_SERVER>/job/<MY_JOB>/api url's instructions for deleting a job. This involved sending a POST request to http://<MY_SERVER>/job/<MY_JOB>/doDelete. When I navigate to my Jenkins job's api url, it advises me to send an HTTP DELETE to http://<MY_SERVER>/job/<MY_JOB>. Using Postman, this doesn't work. The old method using doDelete however does work.

Can anyone explain this behavior? For now I'll be using the old method.

The version of Jenkins I'm using is CloudBees Jenkins Enterprise 2.249.2.4-rolling.

Jenkins remove project via API via curl

Matt Case
  • 3
  • 1

1 Answers1

1

just right click and choose copy link address , you can see that there is an ending "/"

so if you want to delete a job named Zap_Scan, use:

 DELETE https://jenkins.io/job/Zap_Scan/

don't use

 DELETE https://jenkins.io/job/Zap_Scan

that's don't remove the last forward slash.

Note: the success response code will be 204

PDHide
  • 18,113
  • 2
  • 31
  • 46
  • That did the trick, thank you. Just curious, is doDelete deprecated? – Matt Case May 21 '21 at 13:16
  • @MattCase when you do delete from UI the backend call is done using doDelete so i don't think it will be deprecated anytime soon. dodelete doesn't look like a strict rest complaint as that endpoint doesn't point to a specific resourse thats why the new api i guess – PDHide May 21 '21 at 13:21