查询某个仓库的提交信息
功能介绍
根据仓库短ID获取提交信息,支持根据文件路径,查询这个路径下所有的commits列表。
URI
GET /v2/projects/{repo_id}/repository/commits
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
repo_id |
是 |
Integer |
参数解释: 仓库短id 约束限制: 必传 取值范围: 0-2147483647 默认取值: 不涉及 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
ref_name |
否 |
String |
参数解释: 仓库的branch名或tag名,如果为空则查询默认分支 约束限制: 无 取值范围: 最小长度:1 最大长度:200 默认取值: 默认分支 |
|
since |
否 |
String |
参数解释: 在此日期之后或当天提交,格式 YYYY-MM-DDTHH:MM:SSZ 约束限制: 无 取值范围: 不涉及 默认取值: 无 |
|
until |
否 |
String |
参数解释: 在此日期之前或当天提交,格式 YYYY-MM-DDTHH:MM:SSZ 约束限制: 无 取值范围: 不涉及 默认取值: 无 |
|
path |
否 |
String |
参数解释: 文件路径 约束限制: 无 取值范围: 不涉及 默认取值: 无 |
|
all |
否 |
Boolean |
参数解释: 是否检索仓库中每个提交 约束限制: 无 取值范围: 不涉及 默认取值: 无 |
|
with_stats |
否 |
Boolean |
参数解释: 有关每个提交的统计信息是否添加到响应中 约束限制: 无 取值范围: 不涉及 默认取值: 无 |
|
page |
否 |
Integer |
参数解释: 分页索引。 约束限制: 无 取值范围: 最小值:1 最大值:2147483647 默认取值: 1 |
|
per_page |
否 |
Integer |
参数解释: 每页条目数 约束限制: 无 取值范围: 最小值:1 最大值:100 默认取值: 100 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 必传。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error |
Error object |
参数解释: 响应错误码 |
|
result |
Array of CommitInfo objects |
参数解释: 响应结果 |
|
status |
String |
参数解释: 调用此接口的响应状态。 取值范围:
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
code |
String |
参数解释: 错误码 取值范围: 符合错误码格式字符串,长度[0,100] |
|
message |
String |
参数解释: 错误信息 取值范围: 不涉及 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
参数解释: 提交对应的SHA id |
|
short_id |
String |
参数解释: 提交对应的短SHA id |
|
title |
String |
参数解释: 提交标题 |
|
author_name |
String |
参数解释: 作者 |
|
author_email |
String |
参数解释: 作者邮箱 |
|
committer_name |
String |
参数解释: 提交作者 |
|
committer_email |
String |
参数解释: 提交作者邮箱 |
|
created_at |
String |
参数解释: 创建时间 |
|
message |
String |
参数解释: 提交信息 |
|
parent_ids |
Array of strings |
参数解释: 父提交id |
|
committed_date |
String |
参数解释: 提交时间 |
|
authored_date |
String |
参数解释: 作者提交时间 |
请求示例
GET https://{endpoint}/v2/projects/859341/repository/commits
响应示例
状态码: 200
OK
{
"result" : [ {
"id" : "85a0a9d5c6e43bc9c3e443ac01f789e24eeef02b",
"title" : "some commit message",
"message" : "some commit message",
"short_id" : "85a0a9d5",
"author_name" : "repo",
"author_email" : null,
"committer_name" : "repo",
"committer_email" : null,
"created_at" : "2021-09-26T03:44:51.000Z",
"parent_ids" : [ "5c114bb316dff4d4a046e09a5c44c816f2433140" ],
"committed_date" : "2021-09-26T03:44:51.000Z",
"authored_date" : null
}, {
"id" : "5c114bb316dff4d4a046e09a5c44c816f2433140",
"title" : "更新README.md",
"message" : "更新README.md",
"short_id" : "5c114bb3",
"author_name" : "repo",
"author_email" : null,
"committer_name" : "repo",
"committer_email" : null,
"created_at" : "2021-08-26T12:02:58.000Z",
"parent_ids" : [ "646fc72bd87eb02e1e84bf3b82179c7f6d22c2c2" ],
"committed_date" : "2021-08-26T12:02:58.000Z",
"authored_date" : null
} ],
"status" : "success"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
错误码
请参见错误码。