How setting visite api without sign in

hi.i create a custom jenkisn plugin in version 2.401.2.
i want visite the api directly, but when i visite it, the sever redirected to login page.
any one can help me.

@Extension
public class Strategy implements RootAction {

    @GET
    @WebMethod(name = "demo1")
    public void demo1(@QueryParameter(required = true) String key, @QueryParameter(required = true) String value) throws IOException {
        
    }

    @Override
    public String getIconFileName() {
        return null;
    }

    @Override
    public String getDisplayName() {
        return null;
    }

    @Override
    public String getUrlName() {
        return "demo";
    }
}

You need to implement UnprotectedRootAction when you want to be able to access it without the need to login.
Beware what you expose here as this can be read by everyone.

thx, it`s works. the code i exposed is demo meanless.

1 Like

Thanks for the feedback.