文档首页> 代码托管 CodeArts Repo> API参考> API> Repository> 根据仓库id查询仓库某分支对应的提交,提供更多可选参数
更新时间:2023-06-01 GMT+08:00
分享

根据仓库id查询仓库某分支对应的提交,提供更多可选参数

功能介绍

根据仓库id查询仓库某分支对应的提交.

调试

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

URI

GET /v1/repositories/{repository_id}/commits

表1 路径参数

参数

是否必选

参数类型

描述

repository_id

Integer

仓库主键id

表2 Query参数

参数

是否必选

参数类型

描述

author

String

提交作者

begin_date

String

起始提交日期,格式为yyyy-MM-dd

end_date

String

终止提交日期,格式为yyyy-MM-dd

message

String

提交信息

page_index

Integer

分页索引

缺省值:1

page_size

Integer

每页数据量

缺省值:10

path

String

文件路径

ref_name

String

分支或标签名,支持SHA格式

stat_format

String

提交的文件变更详情信息(不包含diff)

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

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

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

error

Error object

响应错误

result

CommitList object

响应结果

status

String

响应状态

表5 Error

参数

参数类型

描述

code

String

错误码

message

String

错误信息

表6 CommitList

参数

参数类型

描述

commits

Array of Commit objects

提交列表

total

Integer

提交总数

表7 Commit

参数

参数类型

描述

author_email

String

作者邮箱

author_name

String

作者

authored_date

String

作者提交时间

committed_date

String

提交时间

committer_email

String

提交作者邮箱

committer_name

String

提交作者

format

Object

文件变更的详情信息,其格式由请求查询参数 stat_format 决定

id

String

提交对应的SHA id

message

String

提交的信息

parent_ids

Array of strings

父提交id

请求示例

null

GET https://{endpoint}/v1/repositories/{repository_id}/commits

响应示例

状态码: 200

OK

{
  "result" : {
    "total" : 1,
    "commits" : [ {
      "id" : "a27fafa7d8da2dd55f691bef989226d22f50d8ce",
      "message" : "Initial commit",
      "parent_ids" : [ ],
      "authored_date" : null,
      "author_name" : "repo",
      "author_email" : "repo@huawei.com",
      "committed_date" : "2019-10-15 09:40:29",
      "committer_name" : "repo",
      "committer_email" : "repo@huawei.com"
    } ]
  },
  "status" : "success"
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品