Ryan E.
Ryan E.

Reputation: 1017

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

azure devops project settings

Upvotes: 7

Views: 8854

Answers (1)

4c74356b41
4c74356b41

Reputation: 72171

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

Upvotes: 14

Related Questions