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

Create JIRA issues from Confluence with REST

Robin Peters
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.
September 3, 2015

Hey,

I try to add a Link to create JIRA issues in Confluence with REST.

Of course, I had to add CORS to the JIRA Apache configuration and the creation works nicely.
But the users have to write their password in a field for the authentication, although their Confluence Login is same to the JIRA Login.
Is there a way to use the Confluence authentication?

There is a firefox addon "Poster" where I can create issues with REST without giving the authentication credentials directly if I am logged in JIRA. Is there a way to transfer this behavior to my script?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Tim
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.
September 3, 2015

Any particular reason, why you don't use Application Links to connect JIRA with Confluence?

Robin Peters
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.
September 3, 2015

I connected both. But I can't use an issue collector, because I need to create several issues with labels out of Confluence. I tried to use this too: {code} http://wiki.XXXXXX.com/plugins/servlet/applinks/proxy?appId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&path=http://jira.XXXXXX.com/rest/api/2/issue{code} But there are problems with POST requests. GET works fine, but the committed parameters of POST weren't correct. I always get an HTTP 400 Bad request.

Tim
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.
September 4, 2015

Did you also try http://wiki.XXXXXX.com/rest/jira-integration/1.0/issues?applicationId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx {"issues":[{"fields":{"project":{"id":"xxxxx"},"issuetype":{"id":"x"},"summary":"test","description":"text"}}]}

Robin Peters
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.
September 4, 2015

Many thanks! This works. Can you tell me, where you found this REST path?

Tim
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.
September 4, 2015

Sure, I copied it from Firebug while creating a new JIRA issue in the editor via the JIRA Issues Macro (https://confluence.atlassian.com/doc/jira-issues-macro-139380.html)

csolyom September 26, 2018

But is there a way to make it work in the first format? The one with /jira-integration/ is giving me HTTP 500

 

For me the 'GET' calls are working as you described:

$.ajax({
url: '<CONFLUENCE URL>/plugins/servlet/applinks/proxy?appId=<APP_ID>&path=<JIRA_URL_ENCODED>%2Frest%2Fapi%2F2%2Fissue%2FISSUE-123',
type: 'get',
contentType: 'application/json',
success: function (resp) { },
});

but the 'POST' requests always fail with HTTP 400 Bad request: "The request sent by the client was syntactically incorrect"

var jiraData = {"fields": {"project": { "key": "PRJ" },"summary": "dummy","description": "test","issuetype": { "name": "Task" }}}

$.ajax({
url: '<CONFLUENCE URL>/plugins/servlet/applinks/proxy?appId=<APP_ID>&path=<JIRA_URL_ENCODED>%2Frest%2Fapi%2F2%2Fissue',
type: 'post',
contentType: 'application/json',
data: JSON.stringify( jiraData ),
success: function (resp) { },
});

I am thinking that the JSON should be formatted/escaped somehow.. any clue?

I use: JIRA v7.2.7, Confluence 6.4.3

0 votes
g000m October 1, 2015

So your purpose was to automate creation of a group of sub-tasks w/ a parent, and Confluence is more like your input template. Interesting. 

We're using a Confluence template as a form to hold project descriptions with definitions, authorizations, validation, etc. Almost all text. But we associate a JIRA epic with each for status tracking & task assignment.

You've managed to create issues on saving a page using the blueprint- That sounds great & I'd love to know what you did. Are you creating the issues with javascript? I don't know what logic you can embed in a blueprint yet.

Robin Peters
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.
October 1, 2015

I made several blueprints and they are a mix of Javascript and Java. The creation of the issues directly is done in Java. I use the onBlueprintCreateEvent for doing this. So several information of the page and an earlier Wizard can inserted in the issue. The JIRA information and creation is done with the JIRA REST API. Because the pages contains a link to the created issue, it was necessary to pre- and post-renderer coded with javascript. JIRA and Confluence are a powerful bundle to work with.

Like Priya N likes this
cepedanicolasN June 29, 2017

Hi Robin,

I have been creating issues with POST also without a problem, but couldn't manage to DELETE or MODIFY issues. Have you done this through confluence?

Regards

shabeer.ak August 28, 2018

@cepedanicolasN were u able to find the route to DELETE or MODIFY an existing issue using rest/jira-integration/1.0

0 votes
g000m September 29, 2015

@Robin Peters, would you mind elaborating on what you've done with this? I'm working on automatically creating an associated JIRA epic per Confluence page. Is that what you're doing here?

Robin Peters
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.
September 29, 2015

No, I created a HTML Page inserted with the HTML Macro. There you can add rows to a table and can fill the cells with data (input-fields). You can press a button and every row will created as a JIRA Sub-Task. A small summary over the whole table will be created as the parent-task. I made blueprints which will create JIRA issues if you save a page using this blueprint. Is this what you want to do?

TAGS
AUG Leaders

Atlassian Community Events