Jira plugin create webhook

Hello all,

I’m using Atlassian SDK to build a Jira plugin and I need to create webhooks inside the plugin. I’ve followed the java doc to develop. The following code is a simple version of my codes:

Builder builder = PersistentWebHookListener.newlyCreated();
builder.setListenerName("name");
builder.setUrl("url");
PersistentWebHookListener source = builder.build();
PersistentWebHookListener target = webHookListenerStore.addWebhook(source, RegistrationMethod.SERVICE);

I’ve got several questions:

  1. The above codes cannot create webhook successfully. The weird thing is that after I ran the above codes to create a webhook(let’s say webhook1) and then create another webhook(let’s say webhook2) via REST API provided by Jira. Both webhook1 and webhook2 can be created successfully. My guess is that the above codes don’t commit the transaction but I can’t find any methods in the SDK to commit.
  2. The second parameter of the method addWebhook in the above codes is the RegistrationMethod. The java doc I found didn’t clarify what each value of RegistrationMethod means. I wonder what’s the difference between RegistrationMethod.SERVICE, RegistrationMethod.REST and RegistrationMethod.UI.

Regards,
Yaoqi Huang

Hello all,

After some tests I found that when I created webhooks in the plugin and got the webhooks from plugin, the newly created webhook will be in the result list. But the RESTAPI and UI wouldn’t return the newly created webhook. So I think that the RESTAPI and UI returns the webhook list in the cache layer but I still couldn’t find how to flush the cache to store the newest version of webhook.
Please kindly help me on this issue. Thanks in advance.

Regards,
Yaoqi Huang