Querying a Commit Message of a Repository
Function
This API is used to obtain a commit message by the repository short ID. The list of all commits in a path can be queried by the file path.
URI
GET /v2/projects/{repo_id}/repository/commits
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repo_id |
Yes |
Integer |
Explanation: Repository short ID. Constraints: Mandatory Range: 0–2147483647 Default value: None |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ref_name |
No |
String |
Explanation: Branch or tag name of a 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: Date after which the commit operation is performed or on the current day. The format is YYYY-MM-DDTHH:MM:SSZ. Constraints: None Range: None Default value: None |
until |
No |
String |
Explanation: Date after which the commit operation is performed or on the current day. The format is YYYY-MM-DDTHH:MM:SSZ. 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: Minimum value: 1 Maximum value: 2147483647 Default value: 1 |
per_page |
No |
Integer |
Explanation: Record number on each page. Constraints: None Range: Minimum value: 1 Maximum value: 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 IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. Constraints: Mandatory Range: 1–100,000 characters. Default value: None |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
error |
Error object |
Explanation: Response error code. |
result |
Array of CommitInfo objects |
Explanation: Response result. |
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 a commit. |
short_id |
String |
Explanation: Short SHA ID of a commit. |
title |
String |
Explanation: Commit title. |
author_name |
String |
Explanation: Author. |
author_email |
String |
Explanation: Author email. |
committer_name |
String |
Explanation: Committer. |
committer_email |
String |
Explanation: Committer email. |
created_at |
String |
Explanation: Creation time. |
message |
String |
Explanation: Commit message. |
parent_ids |
Array of strings |
Explanation: Parent commit ID. |
committed_date |
String |
Explanation: Commit time. |
authored_date |
String |
Explanation: Author commit time. |
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.