I've been able to find documentation on creating work items via the VSTS REST API, however, I haven't been able to find anything creating a work item and linking it to a Parent work item.
Searching around, I've seen some links regarding a System.LinkTypes.Hierarchy-Reverse
, but no API reference on how it works, or how it might link a work item to a parent work item id. Link here
Applying Child Tasks Find and select the Create Child Tasks option on the toolbar menu of the parent work item (E.g. Product Backlog Item, User Story, Bug). You should now have children associated with the open work item.
From the web portal, open a backlog or query results page, and multi-select the work items you want to add a link to. Open the … context menu of one of the selected work items, choose Add link, and then choose Existing item... or New item....
Link here To add a work item with parent work item linked, you should use the REST API as: POST https:// {accountName}.visualstudio.com/ {project}/_apis/wit/workitems/$ {type}?api-version=4.1
Work Item Parent Column in Azure DevOps. One highly requested, yet simple, feature that has recently been added to Azure DevOps Services is the Work Item Parent Column feature. With this feature, you can now add a column to show the parent of a Work Item in a flat list DevOps query and in your product backlog or sprint backlog.
To add or modify work items, you must be granted Stakeholder access or higher. For details, see Stakeholder access quick reference. To view or modify work items, you must have your View work items in this node and Edit work items in this node permissions set to Allow. By default, the Contributors group has this permission set.
To add work items and exercise all board features, you must be granted Basic access or higher. To view or modify work items, your View work items in this node and Edit work items in this node permissions set to Allow. By default, the Contributors group has this permission set. To learn more, see Set permissions and access for work tracking.
To add a work item with parent work item linked, you should use the REST API as:
POST https://{accountName}.visualstudio.com/{project}/_apis/wit/workitems/${type}?api-version=4.1
application/json-patch+json:
[
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "title"},
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"url": "URL for the parent work item"
}
}
]
Below is the example to create a task mytask
with parent work item (work item id is 184
) linked:
POST https://marinaliu.visualstudio.com/Git2/_apis/wit/workitems/$Task?api-version=4.1
application/json-patch+json:
[
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "mytask"},
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"url": "https://marinaliu.visualstudio.com/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/wit/workItems/184"
}
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With