Querying the Commit List of a Branch Based on the Repository ID
Function
This API is used to query a commit of a repository branch by the repository ID.
URI
GET /v1/repositories/{repository_id}/commits
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Explanation Repository ID. You can query the repository list by calling the Querying All Repositories of a User API. Constraints None Range 1–2,147,483,647 Default value: None |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| author | No | String | Explanation Committer. Constraints None Range The value is a string of 0 to 2,000 characters. Default value: None |
| begin_date | No | String | Explanation Start date of a commit. Constraints Must be in the format of yyyy-MM-dd. Range None Default value: None |
| end_date | No | String | Explanation End date of a commit. Constraints Must be in the format of yyyy-MM-dd. Range None Default value: None |
| message | No | String | Explanation Commit message. Constraints None Range None Default value: None |
| page_index | No | Integer | Explanation Page index. Constraints None Range None Default value: 1 |
| page_size | No | Integer | Explanation Number of records on each page. Constraints None Range 1–100 Default value: 20 |
| path | No | String | Explanation File path. Constraints None Range None Default value: None |
| ref_name | Yes | String | Explanation Branch or tag name, in SHA format. Constraints None Range None Default value: None |
| stat_format | No | String | Explanation Commit file change details (excluding diff) Constraints None Range None Default value: None |
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 value is a string of 1–100,000 characters. Default value None |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| error | Error object | Explanation Response error code. Range None |
| result | CommitList object | Explanation Response result. Range None |
| status | String | Explanation Response status. 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 |
|---|---|---|
| commits | Array of Commit objects | Explanation Commit list. Range None |
| total | Integer | Explanation Total commits. Range None |
| Parameter | Type | Description |
|---|---|---|
| author_email | String | Explanation Author email. Range None |
| author_name | String | Explanation Author. Range None |
| authored_date | String | Explanation Author commit time. Range None |
| committed_date | String | Explanation Commit time. Range None |
| committer_email | String | Explanation Committer email. Range None |
| committer_name | String | Explanation Committer. Range None |
| format | Object | Explanation File change details. The format is determined by the stat_format parameter. Range None |
| id | String | Explanation SHA ID of a commit. Range None |
| message | String | Explanation Commit message. Range None |
| parent_ids | Array of strings | Explanation Parent commit ID. Range None |
Example Requests
GET https://{endpoint}/v1/repositories/{repository_id}/commits Example Responses
Status code: 200
OK
{
"result" : {
"total" : 1,
"commits" : [ {
"id" : "a27fafa7d8da2dd55f691bef989226d22f50d8ce",
"message" : "Initial commit",
"parent_ids" : [ ],
"authored_date" : null,
"author_name" : "repo",
"author_email" : "repo@example.com",
"committed_date" : "2019-10-15 09:40:29",
"committer_name" : "repo",
"committer_email" : "repo@example.com"
} ]
},
"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.