How to access confluence REST API from JIRA addon?

Hi, we need to add or update a page on confluence from JIRA cloud addon application. Calling APIs from our addon app generates obvious 401 error.
Is there any way we can add addon system user to confluence application by default and get access to confluence REST api?
We are using atlassian-connect-express for our addon application.

Hi @parag,

You can set the scope of your add-on to use READ, WRITE, or ADMIN. Refer to this for the scopes. And this for each REST required scope.

Cheers,
Anne Calantog

Oooppps may have answered this incorrectly, this is attainable via basic auth but this is not really the way to do things and bad bad practice.

@acalantog’s second response is correct. Atlassian apps do not yet have support for cross product REST API calls. However, this may be possible in the future.

May I ask what you are trying to accomplish? Maybe there is a workaround until that support exists.

Thanks @rmassaioli and @acalantog for the reply.
We have a JIRA addon (Automated Release Notes for JIRA), which enables JIRA project admins to configure project version release notes templates. On releasing a version addon generates html from the template and sends email. Now we want to add feature to post the html to a confluence page (append) or add new page in space.
We needed confluence API access to achieve this, but if cross product access is not available, can you please point out what is the best way to accomplish this?

1 Like

Best way would be to create a second Atlassian Connect application for the Confluence integration. Then just have a way to toss the administrator to the Confluence version to connect your Jira Atlassian Connect application with you Confluence Atlassian Connect application. Once you have those connected you’ll be able to call the confluence rest api’s using the Confluence credentials.

It’s not the cleanest from a user interactive approach however, it is the simplest (otherwise you’ll have to have them configure oauth etc). One benefit of doing it this way is that you could have your customers be able to publish to multiple Confluence instances.

2 Likes

Expanding on what @daniel suggested it might be worth speaking to someone from the eazyBI team because I know they’ve achieved this:

Their main app for JIRA:
https://marketplace.atlassian.com/plugins/com.eazybi.atlassian-connect.eazybi-jira/cloud/overview
A suppporting app for Confluence that allows you to embed their reports into a Confluence page:
https://marketplace.atlassian.com/plugins/com.eazybi.atlassian-connect.eazybi-jira-confluence/versions

They’ve hidden the second Confluence app from marketplace.atlassian.com so it can only be found via UPM within Confluence. I assume this is so people are less likely to start in the wrong place and allows them to better do SEO.

3 Likes

Thank you @daniel and @tim, we will try out the connect app approach as you have suggested.

Hi @daniel,

Any chance you could point me toward some documentation / functionality that would make up some of this so that I can do some research? I am a complete rookie, but I am trying to build something that will allow me post jira content from Confluence.

Thanks
Brendan