GetCommit - Get commit information
Retrieves information about a single commit.
|
Applicable editions |
Central edition, Region edition |
Service endpoints and authorization
- Obtain a service endpoint: Replace {domain} in the request URL with this endpoint.
- Obtain a personal access token.
- Obtain an organization ID: Required only for the Central edition. Find the ID on the Basic Information page of the organization management console.
|
Product |
Resource |
Required permissions |
|
Codeup |
commit |
Read-only |
Request syntax
Central edition
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/commits/{sha}
Region edition
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/commits/{sha}
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
The personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
sha |
string |
path |
Yes |
The SHA of the commit. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
Request examples
Central edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489/commits/6da8c14b5a9102998148b7ea35f96507d5304f74' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Region edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/repositories/2813489/commits/6da8c14b5a9102998148b7ea35f96507d5304f74' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
The response object. |
|
| authorEmail |
string |
The email address of the commit author. |
username@example.com |
| authorName |
string |
The name of the commit author. |
codeup-name |
| authoredDate |
string |
The timestamp when the commit was authored. |
2024-10-05T15:30:45Z |
| committedDate |
string |
The timestamp when the commit was added to the repository. |
2024-10-05T15:30:45Z |
| committerEmail |
string |
The email address of the committer. |
username@example.com |
| committerName |
string |
The name of the committer. |
codeup-name |
| id |
string |
The commit ID. |
6da8c14b5a9102998148b7ea35f96507d5304f74 |
| message |
string |
The commit message. |
commit message detail |
| parentIds |
array[string] |
The parent commit IDs. |
["3fdaf119cf76539c1a47de0074ac02927ef4c8e1"] |
| shortId |
string |
The short commit ID. |
6da8c14b |
| stats |
object |
Line change statistics for additions, deletions, and total changes. Returned only when statistics are available. |
|
| additions |
integer |
The number of lines added. |
1 |
| deletions |
integer |
The number of lines deleted. |
1 |
| total |
integer |
The total number of lines changed. |
2 |
| title |
string |
The first line of the commit message. |
commit msg title |
| webUrl |
string |
The web URL of the commit. |
http://exmaple.com/example_repo/commit/commit_sha |
Response example
{
"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"
}
Error codes
For more information about error codes, see API Error Center.