Search code examples
azureazure-devopsazure-api-apps

How to find Azure Build Items for a specific repo


I am trying to fetch the list of all build items in Azure, and using Postman the following URL shows me the result:

https://dev.azure.com/MyOrganization/MyProject/_apis/build/builds?api-version=6.0

But there is one problem, the query shows me the build for all our company projects whereas I am only intersted in one

enter image description here

The query returns for all projects, but I am only interested in build for Project B

How can I specify this information in the API? I tried the filters and it doesn't work. Also the same for tags


Solution

  • If you take a look at the API Build List documentation, you can see the optional parameters that can be passed to this request

    In this case, you would want to filter on builds from the project B repository, which requires the repositoryType parameter to be passed as well. As such you'd be looking to call

    https://dev.azure.com/{organization}/{project}/_apis/build/builds?repositoryID={repoID}&repositoryType=Git&api-version=6.0
    

    Where the repoID can be found be going into project settings-->repository, clicking the project B repo and copying the value that appears in the website URL after repo=