How to use REST API to add issue links in JIRA issues

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

This article explains the JSON data needed to add issue links to a JIRA issue. This can be done either when creating the issue or when editing the issue

Solution

Creating an issue

  • Make sure Linked Issues is added to the appropriate Create Issue screen
  • Run POST /rest/api/2/issue using the following JSON data

    • {
         "fields":{
            "project":{
               "key":"TEST"
            },
            "summary":"test bug summary",
            "description":"test bug description",
            "issuetype":{
               "name":"Bug"
            },
            "priority":{
               "name":"Major"
            }
         },
         "update":{
            "issuelinks":[
               {
                  "add":{
                     "type":{
                        "name":"Blocks",
                        "inward":"is blocked by",
                        "outward":"blocks"
                     },
                     "outwardIssue":{
                        "key":"TEST-1"
                     }
                  }
               }
            ]
         }
      }

      (info) Replace the values accordingly based on your configuration

Editing an issue

  • Make sure Linked Issues is added to the appropriate Create Issue screen
  • Run PUT /rest/api/2/issue/{issueIdOrKey} using the following JSON data
    • {
         "update":{
            "issuelinks":[
               {
                  "add":{
                     "type":{
                        "name":"Blocks",
                        "inward":"is blocked by",
                        "outward":"blocks"
                     },
                     "outwardIssue":{
                        "key":"TEST-1"
                     }
                  }
               }
            ]
         }
      }

      (info) Replace the values accordingly based on your configuration

It's currently not possible to add multiple issue links in a single REST call. Following Bugs have been raised for thisi

 

 

Last modified on Nov 14, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.