Application Link object usage in plugin

I have created a Confluence plugin to provide a macro. Within this macro, I wish to create a JIRA issue and set a number of fields based on stored page properties. I have an Application Link to my JIRA instance and would like to use this object to remotely create the JIRA issue.

From the java macro plugin, how can I retrieve the Application Link object in order to send my request to JIRA?

Thanks

Hi @michael.r808, not sure this answers your question directly but, first step I wanted to pass on the AppLinks documentation: https://developer.atlassian.com/docs/atlassian-platform-common-components/application-links

There’s been some “prior art posts” about AppLinks on Answers (now Community), e.g., https://community.atlassian.com/t5/Answers-Developer-Questions/Can-I-create-update-an-Application-Link-using-an-REST-java-API/qaq-p/566366 and https://community.atlassian.com/t5/Answers-Developer-Questions/get-application-link-server-JIRA-mainly/qaq-p/554917 and https://community.atlassian.com/t5/Answers-Developer-Questions/Way-to-get-list-of-current-Application-Links-through-Java-API-i/qaq-p/516527

Hope this helps, -nick

Thanks Nick!

I did get this working after sorting out the Spring Scanner versions and using it to inject the ApplicationLinkService into my macro constructor. From there it was straight forward as long as I stuck to 2 legged auth.

Here’s a snippet:

    @ComponentImport
    private final ApplicationLinkService applicationLinkService;
    
    @Autowired
    public createInitiative(final ApplicationLinkService applicationLinkService) { 
    		this.applicationLinkService = applicationLinkService;
    		jiraApplicationLink = applicationLinkService.getPrimaryApplicationLink(JiraApplicationType.class);
                ApplicationLinkRequestFactory requestFactory = jiraApplicationLink.createAuthenticatedRequestFactory();
                ApplicationLinkRequest request = requestFactory.createRequest(MethodType.GET, "/rest/api/latest/issue/test-1");
    }
1 Like

Right on! Good to hear you got going.

-nick