Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Job delete API requires a redirect, which is a bit of work for some clients.

#248

When hitting /api/1/job/[id] with http DELETE, it causes a redirect to /job/apiDeleteJob/[id], but this is a problem without adding redirect logic in modules like Python's urllib2, or adding a handler to support it. Other tools, like Poster's API/REST emulator, do not pass DELETE along with the redirect, so a 405 is returned.

From the IRC:

[11:10] <ameier> Hi all, I'm trying to delete a job via the API, but sending http DELETE to /api/1/job/[id] is failing with 405 Method Not Allowed... any suggestions? This occurs with using Python's urllib2, or through the Poster module in Firefox. Authentication is working, and job creation works (as long as the content type is multipart/form).
 ...
[12:02] <gschueler> however if i try with the Poster extension, it fails with 405.  i think it may not use DELETE when following the 302 redirect
[12:03] <ameier> Ah, so the trick is to follow the redirect
[12:03] <ameier> ?
[12:03] <gschueler> try bypassing the /api request and use /job/apiJobDelete/3
[12:04] <gschueler> (your job id instead of 3)
[12:04] <gschueler> if that works i think the redirect is the issue here
[12:04] <ameier> got it, thanks for your help, will update in a few
[12:05] <gschueler> nb: testing with Poster that seems to work ok for me
[12:09] <ameier> Yup, both Python and Poster don't follow the redirects, and when I was using the test-job-delete.sh script, I think there was a cookie issue on my end. Thank you very much for your help!
[12:09] <Alex-SF> cool. thanks for that gschueler
[12:10] <gschueler> sure, no problem
[12:10] <gschueler> ameier: so did you fix it by using that secondary URL, or by enabling redirects?
[12:11] <gschueler> btw please file this as a bug, i can change the /api url usage so that it doesn't have to perform a redirect

Reported by aaron.meier · March 28th, 2011 @ 11:18 AM

State: new
Milestone: Rundeck 1.3
Assigned to: nobody

Activity

  1. Alex-SF
    Alex-SF
    • Milestone set to Rundeck 1.3
    • Milestone order changed from 20 to 0

    March 28th, 2011 @ 11:20 AM

  2. aaron.meier
    aaron.meier

    Oh, that didn't save newlines like I thought it would. Sorry for the poor formatting.

    March 28th, 2011 @ 11:22 AM

  3. Deleted User
    Deleted User
    • State changed from new to resolved

    (from [47ff2cac8ef358bf251e18365822d3d46ea49ed5]) Fix /api/job endpoint to not redirect for DELETE or GET method [#248 state:resolved] https://github.com/dtolabs/rundeck/commit/47ff2cac8ef358bf251e18365...

    April 21st, 2011 @ 01:20 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.