How make a call for jira-rest api when "/installed" event fire

Hi.

I am developing atlassian connect addon by using atlassian-connect-spring-boot. In here i want to create custom-field when addon is installed into my jira-cloud host. For that i want make a rest call for create new custom-field when "/installed" lifecycle event fire.

I tried to catch "/installed" request by using custom http request Interceptor.  But it never go through this. All other request are gone through as expected. This is the sample code.

@Component
public class RequestInterceptor extends HandlerInterceptorAdapter {

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {

String requestURI = request.getRequestURI();
log.info("preHandle request : " + requestURI + ", method " + request.getMethod());

if ("/installed".equals(requestURI)) {

log.info("/installed preHandle");

try {
log.info("preHandle auth : " + SecurityContextHolder.getContext().getAuthentication().getPrincipal());
} catch (Exception e) {
log.info("/installed preHandle" + e.getMessage());
}

}

return true;

}

@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object object, Exception arg3)
throws Exception {

String requestURI = request.getRequestURI();
log.info("after request : " + requestURI + ", method " + request.getMethod());

if ("/installed".equals(requestURI)) {

log.info("/installed after");

try {
log.info("after auth : " + SecurityContextHolder.getContext().getAuthentication().getPrincipal());
} catch (Exception e) {
log.info("/installed after" + e.getMessage());
}

}



}


 The "/installed" event is authenticated by current user that's why i want to catch that event. Could you please tell me is there any solution for this or is there any other way to create custom-field when install addon. Thanks.

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

850 views 3 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you