Querying a Commit Message of a Repository
Function
This API is used to obtain commit information based on the repository ID or query all commit records in the file path.
URI
GET /v2/projects/{repo_id}/repository/commits
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repo_id |
Yes |
Integer |
Explanation Repository ID. Go to the code page of the repository to view it. Constraints None. Range 0–2147483647 Default value None. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
ref_name |
No |
String |
Explanation Branch name or tag name of the repository. If this parameter is left blank, the default branch is queried. Constraints None. Range Minimum length: 1 Maximum length: 200 Default value Default branch. |
|
since |
No |
String |
Explanation Records submitted after the date. The format is YYYY-MM-DDTHH:MM:SSZ. For example, 2025-07-18T12:34:56Z indicates the UTC time of 12:34:56 on July 18, 2025. Constraints None. Range None. Default value None. |
|
until |
No |
String |
Explanation Records submitted before the date. The format is YYYY-MM-DDTHH:MM:SSZ. For example, 2025-07-19T12:34:56Z indicates the UTC time of 12:34:56 on July 19, 2025. Constraints None. Range None. Default value None. |
|
path |
No |
String |
Explanation File path. Constraints None. Range None. Default value None. |
|
all |
No |
Boolean |
Explanation Whether to search for each commit in a repository. Constraints None. Range None. Default value None. |
|
with_stats |
No |
Boolean |
Explanation Whether statistics about each commit are added to the response. Constraints None. Range None. Default value None. |
|
page |
No |
Integer |
Explanation Page index. Constraints None. Range 1–2147483647 Default value 1 |
|
per_page |
No |
Integer |
Explanation Number of records displayed on each page. Constraints None. Range 1–100 Default value 100 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Explanation User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints None. Range The length range of the character string is [1,100000]. Default value None. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Explanation Response error code. Range None |
|
result |
Array of CommitInfo objects |
Explanation Response result. Range None |
|
status |
String |
Explanation Response status of the API. Range
|
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Explanation Error code. Range Max. 100 characters in the error code format. |
|
message |
String |
Explanation Error message. Range None. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Explanation SHA ID of the commit, which uniquely identifies each commit in the Git version control system. Range 40 |
|
short_id |
String |
Explanation Short SHA ID of the commit, which is usually the first few characters of the SHA ID. Range 8 |
|
title |
String |
Explanation Title submitted by a user in Git. Range None. |
|
author_name |
String |
Explanation Author. Range None. |
|
author_email |
String |
Explanation Author's email address. Range None. |
|
committer_name |
String |
Explanation Committer. Range None. |
|
committer_email |
String |
Explanation Committer email. Range None. |
|
created_at |
String |
Explanation Creation time. Range None. |
|
message |
String |
Explanation Commit message, including the purpose and content of the commit. Range None. |
|
parent_ids |
Array of strings |
Explanation Parent commit ID. When a new commit is created, Git records the commit from which the new commit evolves. The predecessor commit is the parent commit. Range None. |
|
committed_date |
String |
Explanation Commit time. The format is YYYY-MM-DDTHH:MM:SSZ. For example, 2025-07-19T12:34:56Z indicates the UTC time of 12:34:56 on July 19, 2025. Range None. |
|
authored_date |
String |
Explanation Commit time of the author. The format is YYYY-MM-DDTHH:MM:SSZ. For example, 2025-07-19T12:34:56Z indicates the UTC time of 12:34:56 on July 19, 2025. Range None. |
Example Requests
GET https://{endpoint}/v2/projects/859341/repository/commits
Example Responses
Status code: 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": " Update README.md",
"message" : "Update 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"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot