Hi everyone,
I followed this article :
https://confluence.atlassian.com/jirakb/how-to-use-rest-api-to-add-issue-links-in-jira-issues-939932271.html
But it doesn't work.
Here is my request :
{
"fields":{
"project":{
"key":"XX"
},
"summary":"test bug summary",
"description":"test bug description",
"issuetype":
{"id":"XXXXX"}
},
"update":{
"issuelinks":[
{
"add":{
"type":{
"name":"Blocks",
"inward":"is blocked by",
"outward":"blocks"
},
"outwardIssue":{
"key":"XX-967"
}
}
}
]
}
}
Can you please help me ?
using the post('/rest/api/3/issueLink') method works like gangbusters. the "update" method not so much.
Hi,
Is there anyone that manage to create a multiple inward issue?
Extract of automation:
"update":
{"issuelinks":[{
"add": {
"type": {"name": "Blocks"},
"inwardIssue": {"key": "{{#createdIssues.get(7)}}{{key}}{{/}}"},
"inwardIssue": {"key": "{{#createdIssues.get(6)}}{{key}}{{/}}"},
"inwardIssue": {"key": "{{#createdIssues.get(5)}}{{key}}{{/}}"}
}
}]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thanks for reaching out and fist it looks like you are Looking at the Jira Server Docs for the API formatting but your account is tied to a Jira Cloud address, The Formatting you are using for the data portion is for Jira Server and should be working without issue on a POST api/2/issue.
If you are on Jira Server and this is failing what is the full syntax of the call you're using, and what is the Response error message you are getting when the call is failing?
For Jira Cloud:
The Documentation for the API can be found here:
There are a few changes needed for the call on the cloud side, You will want to use the version 3 endpoint for issue and do a POST /rest/api/3/issue
Then there is some additional formatting requirement on the Description where you currently have is set as "description":"test bug description", it should be formatted as follows:
"description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "test bug description", "type": "text" } ] } ] },
So the Full data portion should look like this:
{ "fields":{ "project":{ "key":"XX" }, "summary":"test bug summary", "description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "test bug description" } ] } ] }, "issuetype":{ "name":"Bug" }, "priority":{ "name":"Major" } }, "update":{ "issuelinks":[ { "add":{ "type":{ "name":"Blocks", "inward":"is blocked by", "outward":"blocks" }, "outwardIssue":{ "key":"XX-967" } } } ] } }
Regards,
Earl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Earl, thank you for your answer. You're right, I'm on Jira Cloud sorry. I tried with your answer but I still have the same problem on api/3 or api/2
{
"fields":{
"project":{
"key":"RD"
},
"summary":"test bug summary",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "test bug description"
}
]
}
]
},
"issuetype":
{"id":"XXXX"}
},
"update":{
"issuelinks":[
{
"add":{
"type":{
"name":"Blocks",
"inward":"is blocked by",
"outward":"blocks"
},
"outwardIssue":{
"key":"XX-967"
}
}
}
]
}
}
Curl :
curl -X POST \
https://XXXXX.atlassian.net/rest/api/2/issue \
-H 'Authorization: Basic XXXXXXXXXXXXX' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"fields":{
"project":{
"key":"XX"
},
"summary":"test bug summary",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "test bug description"
}
]
}
]
},
"issuetype":
{"id":"XXXX"}
},
"update":{
"issuelinks":[
{
"add":{
"type":{
"name":"Blocks",
"inward":"is blocked by",
"outward":"blocks"
},
"outwardIssue":{
"key":"XX-967"
}
}
}
]
}
}'
And the API send me this error :
{
"errorMessages": [],
"errors": {
"issuelinks": "Field 'issuelinks' cannot be set. It is not on the appropriate screen, or unknown."
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there,
The formatting looks good but the error you are encountering is related to the field:
"Field 'issuelinks' cannot be set. It is not on the appropriate screen, or unknown."
The noted field "issuelinks" is going to be the "Linked Issues" field on the system front end, And it is either missing from the Create screen of the inward links project or the Edit Screen of the outward links project.
Regards,
Earl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I have exactly same scenario. But my case the field is already there in on the screen.
Still getting below error :
"Field with id' issuelinks' and name 'Linked Issues' does not support operation 'outwardIssue' Supported operation(s) are: 'add'"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it seems this update part simply doesn't work in the create part of the Cloud API. And if you submit a bug report it will rest in "gathering impact" peace for half a decade. So after a few hours and a dozen new gray hairs, here is how I solved it (first create issue, and then update/add a link):
def resultingCreatedIssue = post('/rest/api/2/issue')
.header('Content-Type', 'application/json')
.queryString("overrideScreenSecurity", Boolean.TRUE)
.body(
[
fields:
[
project: [
id: projectId
],
issuetype: [
id: myIssueTypeId
],
summary : samplingRequestSummary,
description: samplingRequestDescription,
(whateverIssueCFID): whateverValue
]
])
.asString().body
JsonSlurper slurper = new JsonSlurper()
def pasedJson = slurper.parseText(resultingCreatedIssue)
assert pasedJson instanceof Map
String createdIssueKey = pasedJson.key
post('/rest/api/3/issueLink')
.header('Content-Type', 'application/json')
//.queryString("overrideScreenSecurity", Boolean.TRUE)
.body([
type:[ name: "Name of My Link" ],
inwardIssue: [key:targetKey],
outwardIssue: [key: createdIssueKey]
])
.asString().body
Hope it saves you guys a few hours ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.