Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get available Area Paths from Azure DevOps Services REST API?

I cannot find how to retrieve the Area Paths from the API. I was able to get to the Iteration Paths but not Area Paths.

I'm technically using the c# wrapper

I've tried going through

  • ProjectHttpClient.GetProject()
  • ProjectHttpClient.GetProjectPropertiesAsync();
  • WorkItemTrackingHttpClient.GetFieldAsync("System.AreaPath");
  • WorkItemTrackingHttpClient.GetWorkItemTypeFieldWithReferencesAsync();
  • I've looked in the WorkHttpClient too since I got the iterations from there.
  • I've looked through the docs and couldn't find anything. Even searching for "area" brings back no results.

azure devops project settings

like image 287
Ryan E. Avatar asked Dec 23 '22 23:12

Ryan E.


1 Answers

Here are the API calls you are looking for:

https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/classification%20nodes/get%20classification%20nodes?view=azure-devops-rest-5.1

GET https://dev.azure.com/{organization}/{project}/_apis/wit/classificationnodes?$depth={$depth}&api-version=5.0

This will give you root nodes and their children, after that you can query individual children, example of the child I'm getting:

id            : 32
identifier    : GUID
name          : childname
structureType : area
hasChildren   : False
path          : \parent\Area\childname
url           : https://dev.azure.com/xxx/yyy/_apis/wit/classificationNodes/Are
                as/childname

C# API:

_destinationTfs = new VssConnection(new Uri(TfsUri), new VssBasicCredential(string.Empty, AccessToken));
_witClient = _destinationTfs.GetClient<WorkItemTrackingHttpClient>();

var areaPathNode = await _witClient.GetClassificationNodeAsync("PROJECT_NAME", TreeStructureGroup.Areas, depth: 1);
// areaPathNode.Children will contain all your area paths.

ps. It's extremely well hidden in the API docs

like image 101
4c74356b41 Avatar answered Feb 15 '23 23:02

4c74356b41