Can I create issue link to External Jira Project site using Jira API Cloud?

Muhammad Imam August 2, 2021

Hi,

 

I'm trying to create issue link to external Jira Project site but the status is status: 404 - Not Found

This my code, I'm create this code in 1st Jira Site Project using script runner console and the link issue destination is 2nd Jira site Project

This my script, please correct my script if there anything wrong with my this

 

import groovy.json.JsonOutput

final externalUrl = "https://my-2ndJIRA-site.atlassian.net"

def body = JsonOutput.toJson(["outwardIssue": ["key": "PERF-1"],
"comment": [
"visibility": [
"type": "group",
"value": "jira-software-users"
],
"body": [
"type": "doc",
"version": 1,
"content": [
"type": "paragraph",
"content": [
[
"text": "Linked related issue!",
"type": "text"
]
]
]
]
],
"inwardIssue": ["key": "SA-2"],
"type": ["name": "Duplicate"]
])

def postResponse = post(externalUrl, "/rest/api/3/issueLink", body)

def post(def hostUrl, def endpointAndQuery, def bodyJson) {
post("$hostUrl$endpointAndQuery")

.header('Authorization', "Basic ${'my-email.com:my-API-token'.bytes.encodeBase64()}")
.header('Accept', 'application/JSON')
.header('Content-Type', 'application/json')
.body(bodyJson)
.asObject(Map)
.body
}

and the error message is

POST request to https://my-2ndJIRA-site.atlassian.net/rest/api/3/issueLink returned an error code: status: 404 - Not Found
body: {errorMessages=[Issue does not exist or you do not have permission to see it.], errors={}}

 

I'm sure this not issue with permission in Jira because I can create link issue manually in the both site (with the same user in API).

Please give me an advices.

0 answers

Suggest an answer

Log in or Sign up to answer