如何在 JAVA 中使用 REST 调用获取 atlassian-stash 项目的分支列表

How to get list of branches on a atlassian-stash project using REST call in JAVA

我发现 stash 提供了一个 REST API 来从在 repository.I 中创建的项目中获取详细信息 我是 stash 的新手 API.Please 让我知道如何在 a 下获取列表分支通过 REST 调用存储项目。

示例存储项目路径

https://stash.test.local/projects/DEV/repos/central-project/browse

在上面 central-project 包含多个分支,例如,

  1. 硕士
  2. feature/test
  3. feature/test1

我想通过 REST 调用获取分支列表。

我终于找到了一种方法来执行 it.For 我在 JAVA 中使用 rest-assured 的 REST 调用。

RestAssured.baseURI = "https://stash.test.local";
RestAssured.basePath = "/rest/api/1.0/projects/DEV/repos/central-project/branches";
RestAssured.authentication = RestAssured.preemptive().basic(
                    username, password);
Response response = RestAssured.get();
String branchJSON = response.asString();