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:
exceptionName: "com.atlassian.integration.jira.JiraCommunicationException"
message: "The server may be unreachable. Please ensure you are running Jira 5.0 or higher."
Any help appreciated.
Thanks.