It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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. 

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 Nov 30, 2019

Hi 

Please let me know how I can get applicationId = YOUR_ID

 

thank you

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

283 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you