azure-devopstfsadoazure-devops-rest-api

Get WorkItem Links with State Via REST API


I'm trying to get the list of links in ADO given the work item ID using a rest API. Also I want to get the state of each linked workitem in the result.

Currently, I am using the below endpoint to get all links, unfortunately, it's not return the state of the workitem.

https://{{coreServer}}/{{organization}}/{{project}}/_apis/wit/workitems/{{workItemId}}?api-version={{api-version}}&$expand=fields

is there any easy way to get it in single API response ?

or can we make a Query request to get all links with state?


Solution

  • There is no method to get the state of linked work items using just one API call.

    Using the API "Wiql - Query By Wiql" also can get the list of linked work items. However, similar to the API "Work Items - Get Work Item", it also only returns the IDs and URLs of the linked work items.

    You need to call the URL of each linked work item to get more detailed properties, such as the value of System.State field.