如何使用 REST API 访问 bitbucket 中的源代码?

How to access source code in bitbucket using REST API?

如何访问位于特定包的回购协议中的 java 文件。 Bit bucket 有元数据信息,比如 pullrequest api,last commit REST APIs。 你能 suggest/help 给我示例 rest call 以及如何传递用户名和密码吗?鉴于我知道完全合格的 class 名称,包括项目。

注意:我们使用的是我们组织托管的 bitbucket。

例如:https://bitbucket.org/repo/my-project 分支:tempBranch 文件:src/main/java/temp/Main.java

我想 access/view 在休息电话中 Main.java 的全部内容。 是否存在任何 REST api?

奇怪的是,无法使用 bitbucket.org(云)的最新版本 (2.0) API。

来自 /repositories/{username}/{repo} 端点的可用数据可能会将您带到某个地方。

您可以使用 /repositories/{username}/{repo}/downloads/{filename} 端点访问存储库 'downloads' 中的文件。


不过There is an endpoint for what you need in version 1.0 of the API。根据测试,这仍然有效。