Adding $JOB_URL/foo REST endpoint from a plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding $JOB_URL/foo REST endpoint from a plugin

Magnus Bäck
I'm trying to add a REST endpoint that mirrors the standard $JOB_URL/buildWithParameters but supports additional URL parameters that I'll translate to a cause when starting a build.

I've created an Action containing

@RequirePOST @WebMethod(name = "") public void doBuildWithEiffelLinks(...) { ... }
public String getUrlName() { return "buildWithEiffelLinks"; }

and with that a POST to $JOB_URL/buildWithEiffelLinks/ works, but if I omit the trailing slash a 302 response is returned. Is there a way to attach the webmethod to the root of the item or do I have to live with the trailing slash or use a URL like $JOB_URL/eiffel/buildWithLinks? Or is this the wrong approach entirely?

Thanks,
Magnus

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/9c5117ce-6308-4a42-a18c-3e1f42c1f20an%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Adding $JOB_URL/foo REST endpoint from a plugin

Jesse Glick-4
On Tue, Feb 9, 2021 at 4:30 PM Magnus Bäck <[hidden email]> wrote:
@RequirePOST @WebMethod(name = "") public void doBuildWithEiffelLinks(...) { ... }

Drop the `@WebMethod` and just use `doIndex`.

Is there a way to attach the webmethod to the root of the item or do I have to live with the trailing slash or use a URL like $JOB_URL/eiffel/buildWithLinks?

 You need to use either the `buildWithEiffelLinks/` or `eiffel/buildWithLinks` style.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3LdmF8Vzza9kDzb9vPhZHn06yN0mPWACXrCYgThgGKJQ%40mail.gmail.com.