Gosfly
Gosfly

Reputation: 1300

Get repositories statistics/information from/in git azure

After researches, my team and I didn't find what we were looking for so one of you might help us.

We are looking for a way to get statistics about all our repos which are on git azure.

We do not need a lot of things, for instance, a list of all our repos (around 150) with the number of branches in each (or better number of branches other than master), as well as the authors of these branches.

These are basics information but we do not know how we could achieve such a thing.

We have already checked analytics views, dashboards, ... but nothing about repositories and branches.

Thanks for your help, Gosfly

Upvotes: 2

Views: 1321

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19381

You can get all the repos in the organization through the below rest api :

https://dev.azure.com/{orgName}/_apis/git/repositories?api-version=5.1

If you want to get all the repos in a specified project, you only need to specify the projectName in the request url :

https://dev.azure.com/{orgName}/{proName}/_apis/git/repositories?api-version=5.1

Test in postman:

enter image description here

Then according to the obtained repository id, through the following api, you can get the number of branches(including master), authors, branch name information.

https://dev.azure.com/{orgName}/_apis/git/repositories/{repoId}/stats/branches

enter image description here

Upvotes: 2

Related Questions