Unable to create JIRA issue from Confluence

P S May 2, 2022

Hello,

I've spent a lot of time trying to get this to work, but no luck.

My goal is from Confluence to create JIRA issues using the JIRA API.

I've tried the 2 approaches below, each of them returning their own errors. At this stage I'm not sure if its due the request I'm making or our JIRA setup (and fyi I have no access to the JIRA/Confluence admin settings, I'm just a user).

In both approaches I have a Confluence page with a HTML section in which I have the following code.

Approach 1

 

let reqData = {
"project": {
"id": "1001"
}
// some more fields here, just simplifying
}
function createMCC() {

jQuery.ajax({

type: "POST",
url: 'https://<MY_CONFLUENCE_URL>/plugins/servlet/applinks/proxy?appId=<JIRA APPID>&path=https://<MY JIRA URL>/rest/api/latest/issue',
data: JSON.stringify(reqData),
contentType: "application/json; charset=utf-8",
processData: false,
headers: { 'X-Atlassian-Token': 'no-check', 'Accept': 'application/json', 'Content-Type': 'application/json' },
dataType: "json",
async: false,
success: function (data) {
console.log(data)
},
error: function (data) {
console.log(data)
}
});

}

This returns a 400 response with the error:

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

 

Approach 2 

 

let reqData = {
issues: [{
"project": {
"id": "1001"
}
// some more fields here, just simplifying
}]
}
function createMCC() {

jQuery.ajax({

type: "POST",
url: 'https://<MY CONFLUENCE URL>/rest/jira-integration/latest/issues?applicationId=<JIRA APP ID>',
data: JSON.stringify(reqData),
contentType: "application/json; charset=utf-8",
processData: false,
headers: { 'X-Atlassian-Token': 'no-check', 'Accept': 'application/json', 'Content-Type': 'application/json' },
dataType: "json",
async: false,
success: function (data) {
console.log(data)
},
error: function (data) {
console.log(data)
}
});

}

Returns a 500 response with the error:

  1. exceptionName"com.atlassian.integration.jira.JiraCommunicationException"
  2. message"The server may be unreachable. Please ensure you are running Jira 5.0 or higher."

 

Any help appreciated.

Thanks.

1 answer

1 vote
Srinatha T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2022

Hi @P S ,

Welcome to Atlassian community. 

You are using the cloud version or server ? I have very basic knowledge on API's , so other community members might help with above errors. 

For server we had this article which has some example code for you. We have some other ways of creating issue's from confluence and you might want to refer the below URL

Have a good day!

Thanks,

Srinath T

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events