Azure DevOps API 从特定管道/存储库/分支获取构建?

问题描述 投票:0回答:1

什么是 Azure Dev Ops API 来获取特定存储库/分支中管道中的所有构建?

这是我试过的:

$url = "https://dev.azure.com/{organization}/{project}/_apis/build/builds?repositoryId=<repository-name>&branchName={branchName}&api-version=7.0"

但是我看到这个错误:

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Repository type is missing/invalid.","typeName":"Microsoft.TeamFoundation.Build.WebApi.RepositoryInformationInvalidException, 
Microsoft.TeamFoundation.Build2.WebApi","typeKey":"RepositoryInformationInvalidException","errorCode":0,"eventId":3000}
At line:1 char:9
+ $api =  Invoke-RestMethod -Uri $uri -Method Get -ContentType "applica ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

我应该输入什么作为存储库类型?

azure-devops-rest-api
1个回答
0
投票

您可以在这里找到的存储库类型:RepositoryTypes Class.

Azure DevOps Git 使用:TfsGit.

此外,请检查您的回购 ID:https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/get?view=azure-devops-rest-4.1&tabs=HTTP

因为使用 repo 名称,您将收到以下消息:

© www.soinside.com 2019 - 2024. All rights reserved.