REST API to create IssueLink
We are struggling now for 2 days to create links between 2 issues. What we would like to achieve is a link of the type "subtaks of".
Setting the issue link directly when creating an issue as described here https://www.jetbrains.com/help/youtrack/standalone/api-entity-Issue.html is not working, as it is also indicating that "links" as well as "parent" are "Read-only
".
Creating just an IssueLink as described here https://www.jetbrains.com/help/youtrack/standalone/api-entity-IssueLink.html is also not working.
Any help or hint is very appreciated!
Please sign in to leave a comment.
Hello,
Please share the request you are using. Also, do you use inCloud or standalone YouTrack? Which Youtrack version do you have?
Thank you.
Sorry that I did not mention that: We are running Youtrack standalone, in the latest version 2019.2 Build 54193.
Thanks. Please share the request you are using
We tested a lot, but a few requests that are not(!) working:
POST http://localhost/api/issues
--------------------------------
POST http://localhost/api/issues
--------------------------------
POST http://localhost/api/issues
--------------------------------
POST http://localhost/api/issues
{
"project":
{
"id":"81-1"
},
"summary":"test",
"description":"test",
"parent":
{
"issues":
[
{"idReadable":"test_dev-2","id":"88-7710"}
],
"linkType":{
"sourceToTarget":"subtask of",
"targetToSource":"parent from",
"directed":true
}
}
}
Hello Martin,
Apologies for the delay. In order to link issues, commands should be used, e.g.
curl -X POST 'https://URL/youtrack/api/commands' -H 'Accept: application/json' -H 'Authorization: Bearer <permanent token>' -H 'Content-Type: application/json' -d '{"query": "Subtask of %issueID%", "issues": [{"id": "%initialIssueID"}, {"id": "'issueID"}]}'.
Please let me know if that helps.