更新时间:2024-01-16 GMT+08:00
分享

获取仓库分支列表

功能介绍

获取仓库分支列表

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v2/repositories/{repository_id}/branches

表1 路径参数

参数

是否必选

参数类型

描述

repository_id

Integer

仓库短id

表2 Query参数

参数

是否必选

参数类型

描述

page

String

分页页数

per_page

String

每页数据数

match

String

匹配条件

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

error

Error object

响应错误

result

BranchResponse object

响应结果

status

String

响应状态

表5 Error

参数

参数类型

描述

code

String

错误码

message

String

错误信息

表6 BranchResponse

参数

参数类型

描述

branches

Array of BranchesItem objects

分支信息

total

Double

总数

表7 BranchesItem

参数

参数类型

描述

commit

CommitV2 object

提交信息

diverging_commit_counts

DivergingCommitCounts object

提交差异数量

name

String

分支名

表8 CommitV2

参数

参数类型

描述

committed_date

String

提交时间

committer_name

String

提交者

id

String

提交id

message

String

提交信息

short_id

String

提交短id

title

String

提交标题

表9 DivergingCommitCounts

参数

参数类型

描述

ahead

Double

领先提交数

behind

Double

滞后提交数

请求示例

GET https://{endpoint}/v2/repositories/{repository_id}/branches

响应示例

状态码: 200

OK

{
  "result" : {
    "total" : 1,
    "branches" : [ {
      "name" : "master",
      "commit" : {
        "id" : "2912b8f2328e798f7d544272ffaebfccccb598ab",
        "title" : "Initial commit",
        "message" : "Initial commit",
        "committed_date" : "2021-12-06T09:24:50.000+08:00",
        "short_id" : "2912b8f2",
        "committer_name" : "repo"
      },
      "diverging_commit_counts" : {
        "behind" : 0,
        "ahead" : 0
      }
    } ]
  },
  "status" : "success"
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品