
This is why proper API documentation and proper status code is important ๐๐๐
Spend half an hour trying to figure out how to delete a #Jenkins #job using โJenkins remote access APIโ ๐ฉ ๐ค ๐ฎ ๐ฑ
You can access all the methods support for an endpoint say for the below job:
https://<Jenkins_url>/job/<job_name>
atย : ๐
https://<Jenkins_url>/job/<job_name>/api

The documentation at this endpoint says, to programmatically delete a job, just do DELETE to โThis URLโ, which on clicking takes us to: ๐ ๐ซ ๐ฉ๐
https://<Jenkins_url>/job/<job_name>/
so I tried #DELETE method onย : ๐ ๐ ๐
https://<Jenkins_url>/job/<job_name>
And guess what we get status #200 but the job never gets deleted after playing around for half an hour by reading many answers online and inspecting the #network tab when you do delete from UI. I identified the below endpoint to do this: ๐ ๐ ๐ ๐ ๐ฉ
https://<Jenkins_url>/job/<job_name>/doDelete
But was still wondering why the documentation was wrongย !!! so gave a last try of adding the front slash as per the URL opened up in the browser: ๐๐
DELETE https://<Jenkins_url>/job/<job_name>/
Guess whatย !!!!! ๐ฐ ๐ฐ I got a status code #204 and JOB got deletedย !!!! ๐ ๐ ๐ ๐
so note: front slash is important if you are playing with Jenkins remote access API ๐ ๐ ๐ ๐
#jenkins #devops #qaengineers #api