【问题标题】:Azure DevOps Rest API - Unable To Create New IterationAzure DevOps Rest API - 无法创建新的迭代
【发布时间】:2019-05-22 18:02:41
【问题描述】:

尝试使用 REST API 为使用 POST 的项目创建迭代:

https://docs.microsoft.com/en-us/rest/api/azure/devops/work/iterations/post%20team%20iteration?view=azure-devops-rest-5.1

但是我不断收到 400 响应。

奇怪的是,我在 UI 中添加了一个(迭代 3) - 当我请求结果时,它不包括新的。

这是不是真的不能正常工作或者我做错了什么?

https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations?api-version=5.0

{
count: 3,
value: [
{
id: "f95df712-1f2d-4685-86ea-b2e7dbad8353",
name: "Iteration 0",
path: "CMMI2\Iteration 0",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "current"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/f95df712-1f2d-4685-86ea-b2e7dbad8353"
},
{
id: "ec4f29f0-0b48-4a52-9b71-45e396654330",
name: "Iteration 1",
path: "CMMI2\Iteration 1",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "future"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/ec4f29f0-0b48-4a52-9b71-45e396654330"
},
{
id: "ab3d8626-c613-48ff-9378-f3b7ed109d77",
name: "Iteration 2",
path: "CMMI2\Iteration 2",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "future"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/ab3d8626-c613-48ff-9378-f3b7ed109d77"
}
]
}

【问题讨论】:

  • 您必须执行 2 个请求。首先创建分类节点,然后使用迭代API分配该分类节点

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


【解决方案1】:

要创建新的迭代,您必须使用另一个 url。你可以在这里找到它们:Classification Nodes - Create Or Update。创建迭代示例:

发布https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/classificationnodes/Iterations?api-version=5.0

请求正文

JSON

{
"name": "最终迭代",
“属性”:{

“开始日期”:“2014-10-27T00:00:00Z”,

“完成日期”:“2014-10-31T00:00:00Z”

}

}

【讨论】:

  • 有没有办法在组织内的多个项目中使用它?我刚刚对此进行了测试,但它失败了,因为迭代名称已在使用中。
【解决方案2】:

您看不到新的迭代,因为您仅在 Project configuration 中添加了迭代,Rest API 与“团队设置”相关。

您还需要在Team configuration 中添加迭代(当您单击它时,您会看到选项卡“迭代”,然后单击“选择迭代”并选择新的)。

如果您需要有关创建迭代的帮助,您必须在此处分享您尝试过的所有代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-19
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2019-08-24
    • 2020-06-12
    • 1970-01-01
    • 2021-01-11
    相关资源
    最近更新 更多