YouTrack Standalone 2020.6 Help

Link Issues

Use Case:

Use the REST API to link issues.

Summary

To link one issue to another, apply a command to the target issue.

Make a POST request to the /api/commands endpoint with the body containing the ID of the target issue and the command query.

Step-by-Step

  1. To apply a command to an issue, make a POST request to the following endpoint: /api/commands.

    Example:

    POST https://example.myjetbrains.com/youtrack/api/commands
  2. In the body of the request, pass a command query and the ID of the issue that you need to apply this command to.

    { "query": "relates to NP-92", "issues": [ { "idReadable": "NP-113" } ] }
  3. To check whether the command was applied successfully, make a GET request to the endpoint /api/issues/NP-113/links where NP-113 is the ID of the target issue.

    Specify link attributes in the fields parameter of your request.

    Example:

    GET https://example.myjetbrains.com/youtrack/api/issues/NP-113/links?fields=linkType(name,sourceToTarget,targetToSource),issues(id,idReadable,summary)

    The expected server response is:

    [ { "linkType": { "sourceToTarget": "relates to", "targetToSource": "", "name": "Relates", "$type": "IssueLinkType" }, "issues": [ { "idReadable": "NP-92", "summary": "Failed test", "id": "99-543", "$type": "Issue" } ], "$type": "IssueLink" }, ... ]
Last modified: 30 March 2021