Create issue and link with existing issue

AI April 2, 2024

I am trying to create an issue via Jira REST API on Postman and Link that issue to existing issue in JSM based on custom field.

Is there any way to Link the issue with existing issues.

Here is my Json to Create an Issue in Jira.

"fields":{
"project":{
"key":"APPI"
},
"priority":{
"name":"Low"
},
"summary":"Test_P2",
"description":{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"Description Test"
}
]
}
]
},
"issuetype":{
"name":"Problem."
},
"assignee":{
"name": "as"
},
"customfield_1000":"Request type",
"customfield_1031":[{'test':
"customfield_1015":"Test_Hard",
"customfield_1030":"Test",
"customfield_1031":"Plants",
"customfield_1032":"line"

1 answer

0 votes
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2024

Hello,

Please review below link:

https://confluence.atlassian.com/jirakb/how-to-use-rest-api-to-add-issue-links-in-jira-issues-939932271.html

You can use solution 2 from above if you want to do it at the time of issue creation, or,

if you want to do it in 2 steps, do it like in solution 1, that is, create your issue, and then make a call to POST rest/api/2/issueLink ..

 

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2024

Hello. The JSON you have shared isnt valid..

I was able to create an issue and link using below JSON. You can just pass a smart value for the issue you want to link it to and also change link type as needed..



{
"fields": {
"project": {
"key": "SUP"
},
"priority": {
"name": "High"
},
"summary": "Test_Postman1",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "description"
}
]
}
]
},
"issuetype": {
"name": "Task"
}
},

"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Blocks",
"inward": "is blocked by",
"outward": "blocks"
},
"outwardIssue": {
"key": "SUP-1"
}
}
}
]
}
}

 

AI April 3, 2024

I have updated the Json, getting below error

Error : {"errorMessages":[],"errors":{"priority":"Field 'priority' cannot be set. It is not on the appropriate screen, or unknown."}}

I have verified the Priority screen its already existed in Create Screen and edit screen

{
   "fields":{
      "project":{
         "key":"NJP"
      },
      "priority":{
         "name":"High"
      },
      "summary":"Test_Postman1",
      "description":{
         "type":"doc",
         "version":1,
         "content":[
            {
               "type":"paragraph",
               "content":[
                  {
                     "type":"text",
                     "text":"description"
                  }
               ]
            }
         ]
      },
      "issuetype":{
         "name":"Problem"
      }
   },
   "update":{
      "issuelinks":[
         {
            "add":{
               "type":{
                  "name":"Problem",
                  "inward":"Problem Link to",
                  "outward":"Problem linked by"
               },
               "outwardIssue":{
                  "key":"NJP-44"
               }
            }
         }
      ]
   }
}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events