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!

 

 

0
5 comments

Hello,

Please share the request you are using. Also, do you use inCloud or standalone YouTrack? Which Youtrack version do you have? 

Thank you. 

0
Avatar
Permanently deleted user

Sorry that I did not mention that: We are running Youtrack standalone, in the latest version 2019.2 Build 54193.

0

Thanks. Please share the request you are using

0
Avatar
Permanently deleted user

We tested a lot, but a few requests that are not(!) working:

POST http://localhost/api/issues

{
"project": {"id": "81-1"},
"summary": "REST API lets you create issues! - test4",
"description": "This is the description",
"parent": "test_dev-66",
}

--------------------------------

POST http://localhost/api/issues

{
"project": {"id": "81-1"},
"summary": "REST API lets you create issues! - test4",
"description": "This is the description",
"links": [
{
"direction": "INWARD",
"linkType": {
"name": "Subtask",
"sourceToTarget": "parent for",
"targetToSource": "subtask of",
"directed": true
},
"issues": [ { "idReadable": "test_dev-6" } ]
}
]
}

--------------------------------

POST http://localhost/api/issues

{
"project":
{
"id":"81-1"
},
"summary":"test",
"description":"test",
"links":[
{
"issues": [{"idReadable":"test_dev-2","id":"88-7710"}],
"linkType":{
"sourceToTarget":"subtask of",
"targetToSource":"parent from",
"directed":true
}
}
]
}

--------------------------------

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
}
}
}

 

0

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.

0

Please sign in to leave a comment.