无法使用 Azure DevOps API 获取最新版本 [英] Impossible to get the latest build using Azure DevOps API
问题描述
我正在尝试使用此 GET 请求获取它:
https://dev.azure.com/LumiaWOA/Boot%20Shim/_apis/build/latest/UEFI%20PreLoader Build?branchName=msm8994-pcie&api-version=5.0-preview.1
我得到的只是这个回复:
<代码>{"$id": "1",内部异常":空,"message": "无法序列化类型 Microsoft.TeamFoundation.Build.WebApi.Build,因为不满足安全要求 Namespace:33344d9c-fc72-4d6f-aba5-fa317101a7e9, RequestedPermissions:1, DataspaceIdentifier: 328eea29-7d2b948c-d58c53d8f29d","typeName": "System.InvalidOperationException, mscorlib","typeKey": "InvalidOperationException",错误代码":0,事件ID":0}
我不明白为什么我会收到这个错误,因为构建对每个人都是公开的:请检查它:
我的解决方法是我们可以使用带有 $top =1
的列表构建方式来获取最新构建.有关详细信息,请参阅 列表构建 API.
https://dev.azure.com/{orgName}/{projectNam}/_apis/build/builds?definitions=defintionId&$top=1&api-version=5.0-preview.5
I'm trying to get it using this GET request:
https://dev.azure.com/LumiaWOA/Boot%20Shim/_apis/build/latest/UEFI%20PreLoader Build?branchName=msm8994-pcie&api-version=5.0-preview.1
All I get is this response:
{
"$id": "1",
"innerException": null,
"message": "Cannot serialize type Microsoft.TeamFoundation.Build.WebApi.Build, because the security requirements are not met Namespace:33344d9c-fc72-4d6f-aba5-fa317101a7e9, RequestedPermissions:1, DataspaceIdentifier: 328eea29-7d2f-4cdf-b928-d58c53d8f29d",
"typeName": "System.InvalidOperationException, mscorlib",
"typeKey": "InvalidOperationException",
"errorCode": 0,
"eventId": 0
}
I don't understand why I'm getting that error, since the builds are public for everyone: Please, check it: https://dev.azure.com/LumiaWoA/Boot%20Shim/_build?definitionId=3
But it shows this error.
Based on my test, I also can reproduce the issue as you mentioned. From the response error message 500. It is not relate to authentication. It seems there is something wrong with Azure Devops API from server side. I recommend that you could give your feedback to azure devops.
My workaround is that we could use the list build ways with $top =1
to get the latest build. For more information please refer to List build API.
https://dev.azure.com/{orgName}/{projectNam}/_apis/build/builds?definitions=defintionId&$top=1&api-version=5.0-preview.5
这篇关于无法使用 Azure DevOps API 获取最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!