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
-
To apply a command to an issue, make a POST request to the following endpoint:
/api/commands
.Example:
POST https://example.youtrack.cloud/api/commands -
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" } ] } -
To check whether the command was applied successfully, make a GET request to the endpoint
/api/issues/NP-113/links
whereNP-113
is the ID of the target issue.Specify link attributes in the
fields
parameter of your request.Example:
GET https://example.youtrack.cloud/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: 7 November 2024