Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am unable to create a Jira Issue from Confluence User Macro!

Spencer Robertson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 28, 2019

I am attempting to create a Jira Issue from the confluence user macro. In this macro I am using jQuery to post to my Jira Instance. I am using the application links to do this and when I do I get a 411 error (length required).

var baseUrl = "https://www.my-confluence.co.uk/plugins/servlet/applinks/proxy?appId=MY_ID_NUMBER&path="
var createIssue = "https://www.my-jira..co.uk/rest/api/2/issue";
var datos = {
"fields": {
"project":
{
"key": "TEST"
},
"summary": "Test Ticket",
"reporter": "me.name",
"issuetype": {
"name": "Task"
},
}
};

var parameters = JSON.stringify(datos);

jQuery.ajax({
url: baseUrl + createIssue,
type: 'POST',
dataType: 'json',
contentType: 'application/json',
data: parameters ,
processData: false,
async: false,
success: function (data) {
alert(JSON.stringify(data));
},
error: function(error){
alert(JSON.stringify(error));
}
}); 

I have tried many things to try to get this to work. I have use just basic authentication instead of the application link and that also does not work, however it raises a different error to 411. Any help would be greatly appreciated. 

2 answers

0 votes
Spencer Robertson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 5, 2019

Figured it out in the end. Had to reverse engineer the confluence macro to add a Jira Issue, the application link URL in my old code does not work. The following code should work:

Query.ajax({
url: 'https://my-confluence.co.uk/rest/jira-integration/1.0/issues?applicationId=YOUR_ID,
type: 'POST',
dataType: 'json',
contentType: 'application/json',
data: parameters,
processData: false,
async: false,
success: function(data) {
alert(JSON.stringify(data));
}
error: function(error) {
console.log('Error');
}
});
thaipq
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2019

Hi 

Please let me know how I can get applicationId = YOUR_ID

 

thank you

0 votes
Haran Kumar
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.
March 4, 2019

Hi @Spencer Robertson 

I'm not a coder & I'm technically novice to coding. Yet I feel i can give you some points which might help you in attaining your requirements.  Yet i'm not sure how good this will hold: 

The required fields  Date of First Response and Time in Status are not available. If you can come up with some script to include these , I guess you might be able to take it up . 

Regards. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events