Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Querying a Commit of a Branch by Repository or Repository Group Name
Updated on 2026-01-27 GMT+08:00

Querying a Commit of a Branch by Repository or Repository Group Name

Function

This API is used to obtain the repository branch commit list based on the repository group name, repository name, and branch name.

URI

GET /v1/repositories/{group_name}/{repository_name}/commits

Table 1 Path parameters

Parameter

Mandatory

Type

Description

group_name

Yes

String

Explanation

Repository group name (the segment between the domain name and repository name in a clone address).

Example: git@repo.example.com:Demo00228/testword.git. Demo00228 is the group name.

Constraints

None

Range

The value is a string of 1 to 2,000 characters.

Default value

None

repository_name

Yes

String

Explanation

Repository name

Constraints

None

Range

1–2,000

Default value

None

Table 2 Query parameters

Parameter

Mandatory

Type

Description

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

ref_name

Yes

String

Explanation

Branch or tag name, in SHA format.

Constraints

None

Range

1–2,000

Default value

None

Request Parameters

Table 3 Request header parameter

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

1–100,000 characters.

Default value

None

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Explanation

Response error.

Range

None

result

CommitList object

Explanation

Response result.

Range

None

status

String

Explanation

Response status.

Range

  • success: The API call is successful.
  • failed: The API call failed.
Table 5 Error

Parameter

Type

Description

code

String

Explanation

Error code.

Range

Max. 100 characters in the error code format.

message

String

Explanation

Error message.

Range

None

Table 6 CommitList

Parameter

Type

Description

commits

Array of Commit objects

Explanation

Commit list.

Range

None

total

Integer

Explanation

Total commits.

Range

None

Table 7 Commit

Parameter

Type

Description

author_email

String

Explanation

Commit author email.

Range

None

author_name

String

Explanation

Commit author name.

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/{group_name}/{repository_name}/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.