如何使用其API获取Bitbucket的提交数量

时间:2014-06-24 16:59:17

标签: json rest bitbucket bitbucket-api

有没有办法通过Bitbucket API获取提交次数并在程序中使用它?我不想在一节中显示所有程序员提交的任何消息或任何内容。

我看过API documentation,但仍然无法做到。

1 个答案:

答案 0 :(得分:1)

您可以使用以下网址查询更改集的数量:

https://bitbucket.org/api/1.0/repositories/{account}/{repo}/changesets?limit=0

您必须为您想要了解的存储库更改{account}{repo}。它将返回一个带有count字段的JSON,表示该存储库中的提交数。请记住设置limit=0参数(提供一般信息而不列出提交本身)。

实施例

使用curl命令行工具知道来自atlassian-plugins的{​​{1}} repo中的提交数量:

atlassian

检查第一个字段count,它显示存储库有$ curl "https://bitbucket.org/api/1.0/repositories/atlassian/atlassian-plugins/changesets?limit=0" {"count": 4449, "start": null, "limit": 0, "changesets": []} 次提交。