Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ MergeRequest/ Obtaining Repository Merge Request Statistics
Updated on 2026-01-27 GMT+08:00

Obtaining Repository Merge Request Statistics

Function

This API is used to obtain repository merge request statistics.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsrepo:repository:getMergeRequest

Read

-

-

-

-

URI

GET https://{hostURL}/v4/repositories/{repository_id}/merge-requests/statistic

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

Integer

Definition

You can query the project list to obtain the repository ID by calling the API used to query user's all repositories.

Constraints

N/A

Default Value

N/A

Value range:

1~2147483647

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

iids

Yes

String

Definition

MR IID.

Value range:

1~2000

fields

No

String

Definition

Statistical fields.

Constraints

  • commits_count: number of commits

  • changed_files_count: number of file changes

  • notes_count: number of review comments

  • changed_lines_count: number of changed lines of code

Enumeration values:

  • commits_count

  • changed_files_count

  • notes_count

  • changed_lines_count

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a 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

[items]

Array of MergeRequestStatisticDto objects

MR statistics

Table 5 MergeRequestStatisticDto

Parameter

Type

Description

id

Integer

MR ID

iid

Integer

MR No.

title

String

MR title

state

String

MR status

commits_count

Integer

Number of MR commits

changed_files_count

String

Number of changed MR files

notes_count

NotesCountDto object

Number of MR review comments

changed_lines_count

MergeRequestLineChange object

Number of MR code changes

merge_error

String

MR merge exception information

json_merge_error

Object

MR merge exception information

votes

Integer

MR scores

Table 6 NotesCountDto

Parameter

Type

Description

notes_count

Integer

Total number of review comments

unresolved_notes_count

Integer

Number of unresolved review comments

already_resolved_count

Integer

Number of resolved review comments

need_resolved_count

Integer

Total number of review comments to be resolved

Table 7 MergeRequestLineChange

Parameter

Type

Description

added_lines

Integer

Lines of code added in an MR

removed_lines

Integer

Lines of code deleted in an MR

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Example Requests

None

Example Responses

Status code: 200

OK

{
  "id" : 47858,
  "iid" : 1,
  "title" : "Create file d",
  "state" : "closed",
  "commits_count" : 3,
  "changed_files_count" : "3",
  "notes_count" : 3,
  "changed_lines_count" : 3,
  "merge_error" : null,
  "json_merge_error" : null,
  "votes" : 1
}

Status code: 400

Bad Request

{
  "error_code" : "CH.00405011",
  "error_msg" : "Request error."
}

Status code: 401

Unauthorized

{
  "error_code" : "DEV.00000003",
  "error_msg" : "Authentication information expired."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.