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

Obtaining the Merge Request File Change List

Function

This API is used to obtain the merge request file change list.

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/{merge_request_iid}/changes

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

merge_request_iid

Yes

Integer

Definition

MR internal ID (IID).

Value range:

1~2147483647

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

ignore_whitespace_change

No

Boolean

Definition

Whether to ignore the change of blank quantity.

Range

  • true: ignore the change of blank quantity.

  • false: not to ignore the change of blank quantity.

Default value:

false

force_encode

No

Boolean

Definition

Whether to forcibly convert the file content to the UTF-8 format.

Constraints

  • true: forcibly convert the file content to the UTF-8 format.

  • false: not to forcibly convert the file content to the UTF-8 format.

Default value:

false

file_path

Yes

String

Definition

File path.

Range

1–10,000 characters.

from_diff_id

No

Integer

Definition

ID of the source version for file change comparison.

to_diff_id

No

Integer

Definition

ID of the target version for file change comparison.

offset

No

Integer

Definition

Offset, which starts from 0.

Value range:

0~2147483647

Default value:

0

limit

No

Integer

Definition

Number of returned records.

Value range:

1~100

Default value:

20

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 header parameters

Parameter

Type

Description

X-Total

String

Definition

Total number of file changes.

Table 5 Response body parameters

Parameter

Type

Description

[items]

Array of SimpleMergeRequestChangesDto objects

MR file change list details

Table 6 SimpleMergeRequestChangesDto

Parameter

Type

Description

id

Integer

MR id

repository_id

Integer

Repository ID

title

String

MR title

description

String

MR description

state

String

MR status

source_branch

String

MR source branch name

target_branch

String

MR target branch name

author

UserBasicDto object

User information

web_url

String

MR URL

create_at

String

Time when an MR was created

update_at

String

Last update time of an MR

sha

String

Commit ID of the target version of the current change

change_count

Integer

Number of changed files

diff_refs

DiffRefDto object

MR change commit, including base_sha, start_sha, and head_sha

added_lines

Integer

New line

removed_lines

Integer

Deleted line

changes

Array of FileChangeDto objects

Change file details list

Table 7 UserBasicDto

Parameter

Type

Description

id

Integer

Definition

User ID.

Value range:

1~2147483647

name

String

Definition

Username.

username

String

Definition

Username.

state

String

Definition:

User status

Value range:

  • active: available account

  • blocked: locked user

  • error: The user is not found

Enumeration values:

  • active

  • blocked

  • error

service_license_status

Integer

Service-level permission status. 0: disabled; 1: enabled

avatar_url

String

User profile picture URL

avatar_path

String

User profile picture path

email

String

User email

name_cn

String

Username (CN)

web_url

String

User homepage

nick_name

String

User alias

tenant_name

String

Tenant name

error_message

String

Definition

When some query APIs detect that the user permission in the transfer parameter is insufficient or the user does not exist, the user is returned but the field is not empty for information.

Table 8 FileChangeDto

Parameter

Type

Description

file_path

String

File path

old_path

String

Change file source branch path

new_path

String

Change file target branch path

a_mode

String

Old file permissions

b_mode

String

New file permissions

mode_changed

Boolean

Whether the file permission is changed

file_type

String

File type

new_file

Boolean

New file or not

renamed_file

Boolean

Renamed file or not

deleted_file

Boolean

Deleted file or not

diff

String

Change file content

binary

Boolean

Binary file or not

too_large

Boolean

Large file or not

collapsed

Boolean

Folded file or not

added_lines

Integer

New lines in a file

removed_lines

Integer

Lines deleted from the file

content_sha

String

Latest commit ID of the file

diff_refs

DiffRefDto object

MR change commit, including base_sha, start_sha, and head_sha

Table 9 DiffRefDto

Parameter

Type

Description

base_sha

String

Commit ID of the common ancestor shared by target and source branches

head_sha

String

Latest commit ID of the source branch

start_sha

String

Latest commit ID of the target branch

Status code: 400

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Example Requests

/v4/repositories/2111976239/merge-requests/6/changes

Example Responses

Status code: 200

OK

{
  "id" : 61415,
  "repository_id" : 2111784689,
  "title" : "Update dev",
  "description" : "merge \\\"dev\\\" into \\\"master\\\"\\nUpdate dev",
  "state" : "opened",
  "source_branch" : "dev",
  "target_branch" : "master",
  "author" : {
    "id" : 10311,
    "name" : "repo_xuxu",
    "name_cn" : "repo_xuxu",
    "nick_name" : "repo_xx",
    "tenant_name" : "example_name",
    "username" : "e2dd5152774149298b749e245523bc78",
    "state" : "active",
    "email" : "e2dd5152774149298b749e245523bc78@example.com",
    "web_url" : "https://example.com/e2dd5152774149298b749e245523bc78"
  },
  "web_url" : "https://example.com/yx_test_repo_yangxu00001/author_approval_test/merge_requests/12",
  "sha" : "7817fb2d9d65e64389ce4cebc542aa2948f45da5",
  "change_count" : 1,
  "diff_refs" : {
    "base_sha" : "ee792e378901e39008c6cbdd5bf01b056ba56e9b",
    "head_sha" : "7817fb2d9d65e64389ce4cebc542aa2948f45da5",
    "start_sha" : "283ae4a61aefac2c6c559544ca2af6d1a85ee02b"
  },
  "added_lines" : null,
  "removed_lines" : null,
  "changes" : [ {
    "file_path" : "dev",
    "old_path" : "dev",
    "new_path" : "dev",
    "a_mode" : 33188,
    "b_mode" : 33188,
    "mode_changed" : false,
    "file_type" : "text_type",
    "new_file" : false,
    "renamed_file" : false,
    "deleted_file" : false,
    "diff" : "@@ -1,3 +1,3 @@\\n-dev1111\\n+dev11112222222333\\n",
    "binary" : false,
    "too_large" : false,
    "collapsed" : false,
    "added_lines" : 1,
    "removed_lines" : 1,
    "content_sha" : "7817fb2d9d65e64389ce4cebc542aa2948f45da5",
    "diff_refs" : {
      "base_sha" : "ee792e378901e39008c6cbdd5bf01b056ba56e9b",
      "head_sha" : "7817fb2d9d65e64389ce4cebc542aa2948f45da5",
      "start_sha" : "283ae4a61aefac2c6c559544ca2af6d1a85ee02b"
    }
  } ],
  "create_at" : "2025-02-18T15:20:50.000+08:00",
  "update_at" : "2025-02-26T14:45:45.000+08:00"
}

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.