Obtaining the File Change Tree of a Merge Request
Function
This API is used to obtain the file change list tree of a merge request.
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-trees
|
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 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
approval_user_id |
No |
Integer |
Definition Approver ID. |
|
commit_id |
Yes |
String |
Definition commit ID. Range 1–40 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
|
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
|
Parameter |
Type |
Description |
|---|---|---|
|
X-Total |
String |
Definition Total number of file changes. |
|
Parameter |
Type |
Description |
|---|---|---|
|
[items] |
Array of ChangesTreeDto objects |
MR file change list details |
|
Parameter |
Type |
Description |
|---|---|---|
|
can_show_my_approval_files |
Boolean |
Definition Display the approval file. |
|
tree |
Array of ChangesTreeObjectDto objects |
Definition Change tree. |
|
Parameter |
Type |
Description |
|---|---|---|
|
title |
String |
Definition Change file name. |
|
level |
Integer |
Definition File level. |
|
file_path |
String |
Definition File path. |
|
file_type |
String |
Definition File type. |
|
diff |
ChangesTreeObjectDiffDto object |
Definition File change comparison. |
|
items |
Array of ChangesTreeObjectDto objects |
Definition Subfile change. |
|
Parameter |
Type |
Description |
|---|---|---|
|
diff |
String |
Definition Change content. |
|
new_path |
String |
Definition New change path. |
|
old_path |
String |
Definition Old change path. |
|
a_mode |
String |
Definition Old file permissions. |
|
b_mode |
String |
Definition New file permissions. |
|
new_file |
Boolean |
Definition New file or not. |
|
renamed_file |
Boolean |
Definition Renamed file or not. |
|
deleted_file |
Boolean |
Definition Deleted file or not. |
|
too_large |
Boolean |
Definition Whether the content is too long. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Status code: 401
|
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
{
"can_show_my_approval_files" : null,
"tree" : [ {
"title" : "test2",
"level" : 1,
"file_path" : "test2",
"file_type" : "file",
"diff" : {
"diff" : "",
"new_path" : "test2",
"old_path" : "test2",
"a_mode" : "0",
"b_mode" : "100644",
"new_file" : true,
"renamed_file" : false,
"deleted_file" : false,
"too_large" : false
}
} ]
}
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot