I've just create a Rest module plugin (from this documentation) for my Confluence plugin but when i try to make a js ajax call to my rest endpoint the request fail with no error and no statusCode.
It is really possible to create a rest endpoint module for a confluence server plugin ?
Atlassian-plugin Code:
<rest name="Make Static Rest Resource"
i18n-name-key="make-static-rest-resource.name" key="nimp-pour-test"
path="/make-static" version="1.0">
<description key="make-static-rest-resource.description">Make Static Rest Resource Plugin</description>
</rest>
Rest Code:
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("/makeStatic")
public Response MakeStatic(@QueryParam("pageId") String pageId) {
return Response.ok("test").build();
}
Js Code:
$.ajax({
type : "GET",
url : window.location.origin + "/rest/make-static/1.0/makeStatic",
contentType : 'application/json'
}).always(function(msg) {
console.log("reponse de la requete" + msg)
if (msg == true) {
location.reload();
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Your JS-code should provide query parameter `pageId`. You declared it in java code.
2. Have you annotation `@Path` on your controller?
3. You url in JS is wrong. Should be
Confluence.getContextPath() + 'rest/make-static/1.0/{controllerPath}/makeStatic?pageId=123'
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.