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

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

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.

ソリューション

課題の作成

  • 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

課題を編集する

  • Make sure Linked Issues is added to the appropriate Edit 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

      (info) It is also possible to reference issues by id. To do this, replace "key" with "id" and use the corresponding database issue id.

It's currently not possible to add multiple issue links in a single REST call. The following Bugs have been raised for this:



最終更新日 2021 年 9 月 24 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.