Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Obtaining the Number of Committed Code Lines
Updated on 2026-01-27 GMT+08:00

Obtaining the Number of Committed Code Lines

Function

Obtain the number of committed code lines of a specified branch in the code repository on a specified date.

URI

GET /v3/repositories/{repository_id}/commit-lines

Table 1 Path parameter

Parameter

Mandatory

Type

Description

repository_id

Yes

Integer

Explanation:

Repository ID.

Constraints:

N/A

Range:

1–2147483647

Default value:

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

ref_name

Yes

String

Explanation:

Branch or tag name.

Constraints:

N/A

Range:

1–2,000

Default value

N/A

begin_date

Yes

String

Explanation:

Start date of a commit.

Constraints:

Must be in the format of yyyy-MM-dd.

Range:

N/A

Default value

N/A

end_date

Yes

String

Explanation:

End date of a commit.

Constraints:

Must be in the format of yyyy-MM-dd.

Range:

The interval between begin_date and end_date cannot exceed 60 days.

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

CommitStatistic object

Explanation:

Number of added and deleted code lines.

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 CommitStatistic

Parameter

Type

Description

additions

Integer

Explanation:

Number of added lines.

Range:

N/A

deletions

Integer

Explanation:

Number of deleted lines.

Value range

N/A

Example Requests

GET https://{endpoint}/v2/repositories/907199/commit-lines

Example Responses

Status code: 200

OK

{
  "result" : {
    "additions" : 9,
    "deletions" : 6
  },
  "status" : "success"
}

Status Code

Status Code

Description

200

OK

Error Codes

See Error Codes.