任何Azure DevOps API均可为任何工作项获取Microsoft.VSTS.Scheduling.OriginalEstimate的价值

时间:2020-09-21 15:51:40

标签: azure-devops azure-devops-rest-api azure-boards

任何Azure DevOps API均可获得sprint中任何/所有工作项的Microsoft.VSTS.Scheduling.OriginalEstimate值。

1 个答案:

答案 0 :(得分:1)

任何Azure DevOps API均可获取 Microsoft.VSTS.Scheduling.OriginalEstimate的任何/所有工作项 冲刺。

由于您要在特定的春季尝试使用Microsoft.VSTS.Scheduling.OriginalEstimate获得特定项目的workItems,因此必须结合使用WorkItems-Get/Get batch/ListQuery by WIQL

以下是可以返回给定ID的Microsoft.VSTS.Scheduling.OriginalEstimate的API:

1。我们可以使用Get Work Item来获取有关一个特定工作项的详细信息,响应中将包含有关OriginalEstimate的信息。

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.1-preview.3

enter image description here

2。我们可以使用Get Work Items Batch根据ID获取工作项列表,并可以基于请求正文自定义响应:

POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitemsbatch?api-version=6.1-preview.1

请求正文:

{
  "ids": [
    124,
    125
  ],
  "fields": [
    "System.Id",
    "System.Title",
    "System.WorkItemType",
    "Microsoft.VSTS.Scheduling.OriginalEstimate"
  ]
}

3。Work Items - List可用于列出具有指定字段的所有或特定工作项:

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&fields=System.Id,System.Title,System.WorkItemType,Microsoft.VSTS.Scheduling.OriginalEstimate&api-version=6.1-preview.3

Get Work Items BatchWork Items-List都可以返回值为Microsoft.VSTS.Scheduling.OriginalEstimate的工作项。区别在于Get Work Items Batch使用Post并在请求正文中定义ID,而Work Items-List使用Get并将ID定义为URI参数。

此处的API可基于WIQL获取工作项ID:

Query By Wiql可以返回特定冲刺的工作项目ID:

POST https://dev.azure.com/{organization}/{project}/_apis/wit/wiql?api-version=6.1-preview.2

请求正文:

{
  "query": "Select [System.Id] From WorkItems Where [System.TeamProject] = @project AND [System.IterationPath]= 'YourIterationPath'"
}

If your IterationPath is a child

如果您的IterationPath具有这种结构,则根据您的需要,应将以上YourIterationPath替换为CommonTestsCommonTests\\Iteration 1