无法获取 Azure Devops Workitem 布局

Can't get Azure Devops Workitem layout

获取https://dev.azure.com/{organization}/_apis/work/processes/{processId}/workItemTypes/{witRefName}/layout?api-version=5.0-preview.1

其中,

{processId} : 敏捷的 typeId,检索自 https://dev.azure.com/{organization}/_apis/work/processes?api-version=5.1-preview.2

{witRefName} : Microsoft.VSTS.WorkItemTypes.Bug

响应:

{
    "$id": "1",
    "innerException": null,
    "message": "VS403115:You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process adcc42ab-9882-485e-a3ed-7678f01f66bc as these work item types are locked.",
    "typeName": "Microsoft.TeamFoundation.WorkItemTracking.Server.FormLayout.FormLayoutInfoNotAvailableException, Microsoft.TeamFoundation.WorkItemTracking.Server",
    "typeKey": "FormLayoutInfoNotAvailableException",
    "errorCode": 0,
    "eventId": 3200 
}

文档:https://docs.microsoft.com/en-us/rest/api/azure/devops/processes/layout/get?view=azure-devops-rest-5.0

任何人建议一些方法来检索工作项的布局。

提前致谢!

截图:

[我已将 url 中的组织名称替换为屏幕截图中的测试]

Can't get Azure Devops Workitem layout

根据错误信息,您似乎没有使用正确的休息方法:

You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process

看来您正在使用 post/update 休息方法而不是 Get.

我可以使用 REST API 来获取工作项布局。

首先,使用 REST API Processes - List 得到 typeId:

GET https://dev.azure.com/{organization}/_apis/work/processes?api-version=5.1-preview.2

然后使用 REST API Layout - Get 获取 Workitem 布局:

GET https://dev.azure.com/{organization}/_apis/work/processes/{processId}/workItemTypes/{witRefName}/layout?api-version=5.0-preview.1

更新:

But I still get the same error. I used the process list REST API u have given to get the process typeId and GET http call to retrieve the layout.

我可以为 default 进程重现此问题。但是在我们继承的过程中不会出现这个问题

如果我使用 REST API 布局 - 为默认进程获取,我将得到相同的错误:

VS403115:You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process

显然这不是一个合理的 return 结果,因为我们使用的是 Get 方法,它不会修改表单布局信息。

因此,这是此 REST API 获取工作项布局信息的问题。

我将此问题提交给产品团队:

https://developercommunity.visualstudio.com/content/problem/1127650/the-rest-api-layout-get-does-not-return-the-correc.html

您可以查看该票以获取反馈,或者您可以针对此问题添加评论。