Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Obtaining the Last Commit Statistics of a Repository
Updated on 2026-01-27 GMT+08:00

Obtaining the Last Commit Statistics of a Repository

Function

This API is used to obtain the last commit statistics of a repository.

URI

GET /v1/repositories/{repository_id}/statistics

Table 1 Path parameter

Parameter

Mandatory

Type

Description

repository_id

Yes

String

Explanation:

Repository ID.

Constraints:

N/A

Range:

1–2147483647

Default value:

N/A

Table 2 Query parameter

Parameter

Mandatory

Type

Description

branch_name

Yes

String

Explanation:

Branch name.

Constraints:

N/A

Range:

1–2,000

Default value:

N/A

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 Obtaining a User Token. The value of X-Subject-Token in the response header is the user token.

Constraints:

N/A

Range:

1–100,000 characters.

Default value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Explanation:

Response error code.

Range:

N/A

result

RepoCommitStatistics object

Explanation:

Response result.

Range:

N/A

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:

N/A

Table 6 RepoCommitStatistics

Parameter

Type

Description

all_branch_commits_count

Integer

Explanation:

Total commits.

Range:

N/A

codelines

Array of RepoDailyCodeline objects

Explanation:

Daily committed lines in last 15 days.

Range:

N/A

count

Integer

Explanation:

Total commits in the corresponding repository.

Range:

N/A

event

RepoStatisticsEvent object

Explanation:

Repository statistics status.

Range:

N/A

statistics

Array of RepoStatistics objects

Explanation:

Repository statistics list.

Range:

N/A

total

Integer

Explanation:

Total collects.

Range:

N/A

Table 7 RepoDailyCodeline

Parameter

Type

Description

additions

Integer

Explanation:

Daily increased code lines.

Range:

N/A

date

String

Explanation:

Date.

Range:

N/A

deletions

Integer

Explanation:

Daily deleted code lines.

Range:

N/A

Table 8 RepoStatisticsEvent

Parameter

Type

Description

branch

String

Explanation:

Branch name.

Range:

N/A

created_at

String

Explanation:

Repository statistics creation time.

Range:

N/A

date

String

Explanation:

Repository statistics date.

Range:

N/A

id

Integer

Explanation:

Repository statistical event ID.

Range:

N/A

project_id

Integer

Explanation:

Repository ID

Range:

N/A

status

String

Explanation:

Repository statistics status.

Range:

  • waiting: The statistics is waiting to be collected.
  • active: The statistics are being collected.
  • finish: The statistics collection is complete.

updated_at

String

Explanation:

Repository statistics update time.

Range:

N/A

user_id

Integer

Explanation:

User ID.

Range:

N/A

Table 9 RepoStatistics

Parameter

Type

Description

add_lines

Integer

Explanation:

Add code lines.

branch

String

Explanation:

Branch name.

Range:

N/A

commit_count

Integer

Explanation:

Number of commits.

Range:

N/A

created_at

String

Explanation:

Repository statistics creation time.

Range:

N/A

delete_lines

Integer

Explanation:

Deleted code lines.

Range:

N/A

id

Integer

Explanation:

Repository statistics record ID.

Range:

N/A

project_id

Integer

Explanation:

Repository ID.

Range:

N/A

updated_at

String

Explanation:

Repository statistics update time.

Range:

N/A

user_name

String

Explanation:

Username.

Range:

N/A

Example Requests

None.

Example Responses

Status code: 200

OK

{
  "result" : {
    "event" : null,
    "total" : 0,
    "statistics" : [ ],
    "all_branch_commits_count" : 1,
    "count" : 1,
    "codelines" : {
      "additions" : 0,
      "deletions" : 0,
      "date" : "20191015"
    }
  },
  "status" : "success"
}

Status Code

Status Code

Description

200

OK

Error Codes

See Error Codes.