Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Call Confluence from a JIRA plugin

phil73 April 24, 2015

Hello.

I'm building a workflow post function in a JIRA plugin and would like it to call Confluence to perform some actions.  I assume the right thing to do is to use the Confluence REST API to perform the desired actions but I can't seem to find anything that explains how to do that.

I'm an experienced developer and have written a variety of JIRA plugins but have never had to write a plugin that calls outside of JIRA itself.

Is there an easy way to call Confluence (or any REST service) from inside a JIRA plugin?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
phil73 April 24, 2015

ah ha, I see where I went wrong.  I was mixing REST and SOAP.  I had a code fragment that looks as follows:

URL endpoint = new URL(confluenceURL);
service = serviceLocator.getConfluenceserviceV2();
String token = service.login(confluenceUser, confluencePwd);
RemoteSpace remoteSpace = new RemoteSpace();
remoteSpace.setKey(projectKey);
remoteSpace.setName(projectSpaceName);
remoteSpace.setDescription("Space automatically created via JIRA transition");
remoteSpace = service.addSpace(token, remoteSpace);

The tutorial is focused on REST (which is exactly what I asked for).

Am I correct to assume that REST would be a better way to go that the WebServces/SOAP API?  If not, how do I use SOAP from within a JIRA plugin?

Andreas Ebert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 24, 2015

Yes, use REST if possible. All other remote APIs are deprecated. See: https://developer.atlassian.com/confdev/confluence-rest-api

0 votes
Andreas Ebert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 24, 2015

That is pretty easy if your Confluence is linked via an Application Link. There is a tutorial for pretty much exactly your use-case.

It's also possible without an Application Link, but you have to take care of authentication yourself, which unfortunately I can't help you with.

TAGS
AUG Leaders

Atlassian Community Events