Querying a Specific Commit of a Repository
Function
This API is used to obtain a specific commit by commit ID, branch name, or tag name.
URI
GET /v2/projects/{repo_id}/repository/commits/{sha}
Parameter | Mandatory | Type | Description |
|---|---|---|---|
repo_id | Yes | Integer | Repository short ID. |
sha | Yes | String | Commit ID, which is the branch or tag name of the repository. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
stats | No | Boolean | It includes commit statistics. The default value is true. |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | 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. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
error | Error object | Response error. |
result | SpecificCommitInfo object | Response result. |
status | String | Response status. |
Parameter | Type | Description |
|---|---|---|
id | String | SHA ID of a commit. |
short_id | String | Short SHA ID of a commit. |
title | String | Commit title. |
author_name | String | Author. |
author_email | String | Author email. |
committer_name | String | Committer. |
committer_email | String | Committer email. |
created_at | String | Creation time. |
message | String | Commit message. |
parent_ids | Array of strings | Parent commit ID. |
committed_date | String | Commit time. |
authored_date | String | Author commit time. |
stats | stats object | Number of changed lines. |
last_pipeline | last_pipeline object | Pipeline information. |
Example Requests
GET https://{endpoint}/v2/projects/859341/repository/commits/master 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,
"stats" : {
"additions" : 1,
"deletions" : 0,
"total" : 1
},
"last_pipeline" : {
"id" : 292811,
"sha" : "2202af08836f0afd762d1b151d15ac510b974bdf",
"ref" : "master",
"status" : "running",
"web_url" : "https://test.com/Pipeline_Beta_sdcs00001/202107171926/pipelines/292811"
}
},
"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.

