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:
- 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.
- 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.