0
votes

How do I get a work item's list of predecessors and successors using the Azure DevOps REST API?

I've found the API to list the items from a query and then get individual item details from there, but how do I get the predecessors and successors for each item?

1

1 Answers

1
votes

You can get it with Work Items - Get Work Item with the $expand=relations URL parameter;

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=5.1&$expand=relations

In the results you will get relations section, there you will see the links, in each link there are attributes with name, the name is Child/Successor/Predecessor:

"relations":  [
                  {
                      "rel":  "System.LinkTypes.Dependency-Forward",
                      "url":  "https://dev.azure.com/test/7fcdafd5-b891-4fe5-b2fe-1234567/_apis/wit/workItems/65",
                      "attributes":  "@{isLocked=False; name=Successor}"
                  },