通过 OpenAPI 查询单个提交信息。
适用版本 | 中心版、Region版 |
服务接入点与授权信息
产品 | 资源 | 所需权限 |
代码管理 | 提交 | 只读 |
请求语法
中心版
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/commits/{sha}Region版
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/commits/{sha}请求头
参数 | 类型 | 是否必填 | 描述 | 示例值 |
x-yunxiao-token | string | 是 | 个人访问令牌。 | pt-0fh3****0fbG_35af****0484 |
请求参数
参数 | 类型 | 位置 | 是否必填 | 描述 | 示例值 |
organizationId | string | path |
| 组织 ID。 | 60d54f3daccf2bbd6659f3ad |
repositoryId | string | path | 是 | 代码库 ID 或者 URL-Encoder 编码的全路径。 | 2813489或者60de7a6852743a5162b5f957%2FDemoRepo |
sha | string | path | 是 | 提交 ID,即 Commit SHA 值。 | 6da8c14b5a9102998148b7ea35f96507d5304f74 |
请求示例
中心版
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo/commits/6da8c14b5a9102998148b7ea35f96507d5304f74' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'Region版
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo/commits/6da8c14b5a9102998148b7ea35f96507d5304f74' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'返回参数
参数 | 类型 | 描述 | 示例值 |
| - | object | ||
authorEmail | string | 作者邮箱。 | username@example.com |
authorName | string | 作者姓名。 | codeup-name |
authoredDate | string | 作者提交时间。 | 2024-10-05T15:30:45Z |
committedDate | string | 提交者提交时间。 | 2024-10-05T15:30:45Z |
committerEmail | string | 提交者邮箱。 | username@example.com |
committerName | string | 提交者姓名。 | codeup-name |
id | string | 提交 ID。 | 6da8c14b5a9102998148b7ea35f96507d5304f74 |
message | string | 提交内容。 | commit message detail |
parentIds | array[string] | 父提交 ID。 | ["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"] |
shortId | string | 提交短 ID。 | 6da8c14b |
| stats | object | 变更行数统计(additions/deletions/total);仅当服务端返回统计时存在,对应 JSON 字段名为 stats。 | |
additions | integer | 增加行数。 | 1 |
deletions | integer | 删除行数。 | 1 |
total | integer | 总变动行数。 | 2 |
title | string | 标题,提交的第一行内容。 | commit msg title |
webUrl | string | 页面访问地址。 | http://exmaple.com/example_repo/commit/commit_sha |
返回示例
{
"authorEmail": "username@example.com",
"authorName": "codeup-name",
"authoredDate": "2024-10-05T15:30:45Z",
"committedDate": "2024-10-05T15:30:45Z",
"committerEmail": "username@example.com",
"committerName": "codeup-name",
"id": "6da8c14b5a9102998148b7ea35f96507d5304f74",
"message": "commit message detail",
"parentIds": ["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"],
"shortId": "6da8c14b",
"stats": {
"additions": 1,
"deletions": 1,
"total": 2
},
"title": "commit msg title",
"webUrl": "http://exmaple.com/example_repo/commit/commit_sha"
}错误码
访问错误码中心查看 API 相关错误码。