Azure DevOps API:无法检索区域下的子项

问题描述 投票:0回答:1

我找不到正确的邮递员网址来检索某个区域的子项

你好,

我尝试使用 Postman 检索 Azure DevOps 区域的子项。 我的网址:https://tfs01.red.organization.com/organization/project/_apis/wit/classificationnodes/Areas?depth=10&api-version=7.0

结果:

{
    "id": 6,
    "identifier": "c8a8bd02-ffc8-4c49-a2d4-acc2df90f110",
    "name": "ReD",
    "structureType": "area",
    "hasChildren": true,
    "path": "\\ReD\\Area"
}

所以如果我没记错的话,要找回我需要做的孩子: https://tfs01.red.organization.com/organization/project/_apis/wit/classificationnodes/Areas/Red/Area?深度=10&api-version=7.0

但是返回信息是:

{
    "$id": "1",
    "innerException": null,
    "message": "VS402485: The Area/Iteration name is not recognized: ReD\\Area",
    "typeName": "Microsoft.TeamFoundation.WorkItemTracking.Server.Metadata.WorkItemTrackingTreeNodeNotFoundException, Microsoft.TeamFoundation.WorkItemTracking.Server",
    "typeKey": "WorkItemTrackingTreeNodeNotFoundException",
    "errorCode": 0,
    "eventId": 3200
}

我错过了一些东西,但我不知道是什么...也许名称前有“\”?我已经尝试用 %5C 逃脱但没有成功,结果是一样的

感谢您提供的任何帮助

azure-devops postman
1个回答
0
投票

要检索某个区域下的子节点,您可以使用 REST API 分类节点 - 获取分类节点

例如获取具有3级子级的区域树。

GET https://dev.azure.com/{OrgName}/{ProjName}/_apis/wit/classificationnodes/Areas?$depth=3&api-version=7.1-preview.2

回应:

{
  "id": 4,
  "identifier": "***",
  "name": "{rootAreaName}",
  "structureType": "area",
  "hasChildren": true,
  "children": [
    ...
    {
      "id": 99,
      "identifier": "***",
      "name": "Team2",
      "structureType": "area",
      "hasChildren": false,
      "path": "\\{rootAreaName}\\Area\\Team2",
      "url": "***"
    },
    {
      "id": 385,
      "identifier": "***",
      "name": "Team1",
      "structureType": "area",
      "hasChildren": true,
      "children": [
        {
          "id": 386,
          "identifier": "***",
          "name": "area1",
          "structureType": "area",
          "hasChildren": false,
          "path": "\\{rootAreaName}\\Area\\Team1\\area1",
          "url": "***"
        }
      ],
      "path": "\\{rootAreaName}\\Area\\Team1",
      "url": "***"
    }
  ],
  "path": "\\{rootAreaName}\\Area",
  "_links": {
    "self": {
      "href": "***"
    }
  },
  "url": "***"
}
© www.soinside.com 2019 - 2024. All rights reserved.