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.