如何从 Azure DevOps Services REST API 获取可用区域路径?

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

我找不到如何从 API 检索区域路径。我能够到达迭代路径但不能到达区域路径。

我在技术上使用 c# 包装器

我试过

这是您正在寻找的 API 个电话:

https://docs.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

这将为您提供根节点及其 children,之后您可以查询单个 children,我得到的 child 示例:

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。它非常好地隐藏在 API 文档