Updating the Repository Merge Request Settings
Function
This API is used to update the repository merge request settings of a repository.
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:setRepository |
Write |
- |
- |
- |
- |
URI
PUT https://{hostURL}/v4/repositories/{repository_id}/merge-requests/setting
|
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 |
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 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
review_mode |
No |
String |
Definition Merge method. Enumeration values:
|
|
only_allow_merge_if_all_discussions_are_resolved |
No |
Boolean |
Definition Merge after all reviews are resolved. |
|
must_relate_issue |
No |
Boolean |
Definition Must be associated with CodeArts Req. |
|
only_allow_one_issue_check_passed |
No |
Boolean |
Definition Associate only one ticket number. |
|
need_all_issues_check_passed |
No |
Boolean |
Definition Must be associated with CodeArts Req - All E2E ticket numbers must pass the verification. |
|
need_relate_issue_branches |
No |
String |
Definition Must be associated with CodeArts Req - Select the target branch and configure the MR policy (a character string in which branches are separated by commas). |
|
evaluation_merge_gate |
No |
Boolean |
Definition Use score as a merge gate. |
|
evaluation_role |
No |
Integer |
Definition Whether to use the score as a merge gate - roles that participate in the evaluation. 29: Developer 30: Developer and committer 35: Committer 40: None Enumeration values:
|
|
disable_merge_by_self |
No |
Boolean |
Definition Cannot merge one's own merge requests. |
|
disable_approve_by_self |
No |
Boolean |
Definition Cannot approve one's own merge requests. |
|
disable_review_by_self |
No |
Boolean |
Definition Cannot review one's own merge requests. |
|
can_force_merge |
No |
Boolean |
Definition Allow repo administrator or project manager to forcibly merge code. |
|
add_notes_after_merged |
No |
Boolean |
Definition Allow code review and comment for merged or closed MRs. |
|
mark_auto_merged_mr_as_closed |
No |
Boolean |
Definition Whether to mark the automatically merged MRs as closed. |
|
can_reopen |
No |
Boolean |
Definition Cannot re-open a closed MR. |
|
delete_source_branch_when_merged |
No |
Boolean |
Definition Delete source branch after merge for new MRs. |
|
disable_squash_merge |
No |
Boolean |
Definition Forbid squash merge (Forbid to select squash merge when creating an MR). |
|
auto_squash_merge |
No |
Boolean |
Definition Enable Squash merge for new MRs. |
|
merge_method |
No |
String |
Definition Merge method. merge: Merge commit. rebase_merge: Merge commit with semi-linear history. ff: Fast-forward. Enumeration values:
|
|
squash_merge_with_no_merge_commit |
No |
Boolean |
Definition Do not generate Merge nodes during Squash merge. |
|
merged_commit_author |
No |
String |
Definition merged_by: Use MR merger to generate Merge Commit. created_by: Use MR creator to generate Merge Commit. Enumeration values:
|
|
enable_custom_evaluation |
No |
Boolean |
Definition Enable MR custom evaluation dimension type (MR evaluation settings). |
|
evaluation_types |
No |
Array of strings |
Definition Evaluation dimension (MR evaluation setting). |
|
only_allow_merge_if_vote_bigger_than |
No |
Integer |
Definition Minimum score for merge in the score mode. Value range: 0~5 |
|
only_assignee_can_merge |
No |
Boolean |
Definition: Only mergers can merge MRs. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition Primary key ID. Value range: 1~2147483647 |
|
disable_merge_by_self |
Boolean |
Definition Cannot merge one's own merge requests. |
|
disable_approve_by_self |
Boolean |
Definition Cannot approve one's own merge requests. |
|
disable_review_by_self |
Boolean |
Definition Cannot review one's own merge requests. |
|
created_at |
String |
Definition Creation time. |
|
updated_at |
String |
Definition Update time. |
|
can_force_merge |
Boolean |
Definition Allow repo administrator or project manager to forcibly merge code. |
|
disable_squash_merge |
Boolean |
Definition Forbid squash merge (Forbid to select squash merge when creating an MR). |
|
must_relate_issue |
Boolean |
Definition Must be associated with CodeArts Req. |
|
need_relate_issue_branches |
String |
Definition Must be associated with CodeArts Req - Select the target branch and configure the MR policy (a character string in which branches are separated by commas). |
|
need_all_issues_check_passed |
Boolean |
Definition Must be associated with CodeArts Req - All E2E ticket numbers must pass the verification. |
|
review_mode |
String |
Definition Merge method. Enumeration values:
|
|
add_notes_after_merged |
Boolean |
Definition Allow code review and comment for merged or closed MRs. |
|
merged_commit_author |
String |
Definition merged_by: Use MR merger to generate Merge Commit. created_by: Use MR creator to generate Merge Commit. Enumeration values:
|
|
evaluation_role |
Integer |
Definition Whether to use the score as a merge gate - roles that participate in the evaluation. 29: Developer 30: Developer and committer 35: Committer 40: None Enumeration values:
|
|
evaluation_merge_gate |
Boolean |
Definition Use score as a merge gate. |
|
mark_auto_merged_mr_as_closed |
Boolean |
Definition Whether to mark the automatically merged MRs as closed. |
|
delete_source_branch_when_merged |
Boolean |
Definition Delete source branch after merge for new MRs. |
|
auto_squash_merge |
Boolean |
Definition Enable Squash merge for new MRs. |
|
squash_merge_with_no_merge_commit |
Boolean |
Definition Do not generate Merge nodes during Squash merge. |
|
only_allow_one_issue_check_passed |
Boolean |
Definition Associate only one ticket number. |
|
enable_custom_evaluation |
Boolean |
Definition Enable MR custom evaluation dimension type (MR evaluation settings). |
|
evaluation_types |
Array of EvaluationTypeDto objects |
Definition Evaluation dimension (MR evaluation setting). |
|
can_reopen |
Boolean |
Definition Cannot re-open a closed MR. |
|
only_allow_merge_if_all_discussions_are_resolved |
Boolean |
Definition Merge after all reviews are resolved. |
|
merge_method |
String |
Definition Merge method. merge: Merge commit. rebase_merge: Merge commit with semi-linear history. ff: Fast-forward. Enumeration values:
|
|
only_allow_merge_if_vote_bigger_than |
Integer |
Definition Minimum score for merge in the score mode. Value range: 0~5 |
|
only_assignee_can_merge |
Boolean |
Definition Only these mergers can merge MRs. |
|
repository_id |
Integer |
Definition Repository ID. Value range: 1~2147483647 |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition Custom evaluation primary key ID. Value range: 1~2147483647 |
|
name |
String |
Definition Custom evaluation name. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. |
|
error_msg |
String |
Definition Error message. |
Example Requests
/v4/repositories/123/merge-requests/setting
{
"disable_merge_by_self" : false,
"disable_review_by_self" : false,
"disable_approve_by_self" : false,
"can_force_merge" : false,
"disable_squash_merge" : false,
"must_relate_issue" : false,
"need_relate_issue_branches" : "dev,master",
"need_all_issues_check_passed" : false,
"review_mode" : "vote",
"evaluation_types" : "a,b",
"can_reopen" : true,
"only_allow_merge_if_all_discussions_are_resolved" : false,
"merge_method" : "ff",
"only_allow_merge_if_vote_bigger_than" : 0,
"only_assignee_can_merge" : true
}
Example Responses
Status code: 200
OK
{
"id" : 3223015,
"disable_merge_by_self" : false,
"disable_review_by_self" : false,
"disable_approve_by_self" : false,
"created_at" : "2025-02-25T19:44:44.000+08:00",
"updated_at" : "2025-02-25T20:07:32.000+08:00",
"can_force_merge" : false,
"disable_squash_merge" : false,
"must_relate_issue" : false,
"need_relate_issue_branches" : null,
"need_all_issues_check_passed" : false,
"review_mode" : "vote",
"add_notes_after_merged" : false,
"merged_commit_author" : "created_by",
"evaluation_role" : 35,
"evaluation_merge_gate" : true,
"mark_auto_merged_mr_as_closed" : false,
"delete_source_branch_when_merged" : false,
"auto_squash_merge" : true,
"squash_merge_with_no_merge_commit" : false,
"only_allow_one_issue_check_passed" : false,
"enable_custom_evaluation" : true,
"evaluation_types" : [ {
"id" : 32,
"name" : "a"
}, {
"id" : 33,
"name" : "b"
} ],
"can_reopen" : true,
"only_allow_merge_if_all_discussions_are_resolved" : false,
"merge_method" : "ff",
"only_allow_merge_if_vote_bigger_than" : 0,
"only_assignee_can_merge" : true
}
Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
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