summaryrefslogtreecommitdiff
path: root/doc/api/merge_request_approvals.md
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 08:43:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 08:43:02 +0000
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /doc/api/merge_request_approvals.md
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
downloadgitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'doc/api/merge_request_approvals.md')
-rw-r--r--doc/api/merge_request_approvals.md43
1 files changed, 27 insertions, 16 deletions
diff --git a/doc/api/merge_request_approvals.md b/doc/api/merge_request_approvals.md
index b4403e1d9b9..4ede95ea189 100644
--- a/doc/api/merge_request_approvals.md
+++ b/doc/api/merge_request_approvals.md
@@ -2,7 +2,6 @@
stage: Create
group: Source Code
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
-type: reference, api
---
# Merge request approvals API **(PREMIUM)**
@@ -15,8 +14,7 @@ in the project. Must be authenticated for all endpoints.
### Get Configuration
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/183) in GitLab 10.6.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
You can request information about a project's approval configuration using the
following endpoint:
@@ -44,8 +42,7 @@ GET /projects/:id/approvals
### Change configuration
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/183) in GitLab 10.6.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
If you are allowed to, you can change approval configuration using the following
endpoint:
@@ -180,7 +177,7 @@ GET /projects/:id/approval_rules
### Get a single project-level rule
-> - Introduced 13.7.
+> Introduced in GitLab 13.7.
You can request information about a single project approval rules using the following endpoint:
@@ -294,9 +291,10 @@ POST /projects/:id/approval_rules
| `id` | integer or string | yes | The ID or [URL-encoded path of a project](index.md#namespaced-path-encoding) |
| `name` | string | yes | The name of the approval rule |
| `approvals_required` | integer | yes | The number of required approvals for this rule |
+| `rule_type` | string | no | The type of rule. `any_approver` is a pre-configured default rule with `approvals_required` at `0`. Other rules are `regular`.
| `user_ids` | Array | no | The ids of users as approvers |
| `group_ids` | Array | no | The ids of groups as approvers |
-| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by |
+| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by. To identify the ID, [use the API](protected_branches.md#list-protected-branches). |
```json
{
@@ -379,6 +377,23 @@ POST /projects/:id/approval_rules
}
```
+You can increase the default number of 0 required approvers like this:
+
+```shell
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
+ --header 'Content-Type: application/json' \
+ --data '{"name": "Any name", "rule_type": "any_approver", "approvals_required": 2}'
+```
+
+Another example is creating an additional, user-specific rule:
+
+```shell
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
+ --header 'Content-Type: application/json' \
+ --data '{"name": "Name of your rule", "approvals_required": 3, "user_ids": [123, 456, 789]}' \
+ https://gitlab.example.com/api/v4/projects/<project_id>/approval_rules
+```
+
### Update project-level rule
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11877) in GitLab 12.3.
@@ -402,7 +417,7 @@ PUT /projects/:id/approval_rules/:approval_rule_id
| `approvals_required` | integer | yes | The number of required approvals for this rule |
| `user_ids` | Array | no | The ids of users as approvers |
| `group_ids` | Array | no | The ids of groups as approvers |
-| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by |
+| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by. To identify the ID, [use the API](protected_branches.md#list-protected-branches). |
```json
{
@@ -509,8 +524,7 @@ Configuration for approvals on a specific Merge Request. Must be authenticated f
### Get Configuration
-> - Introduced in GitLab 8.9.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
You can request information about a merge request's approval status using the
following endpoint:
@@ -556,8 +570,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/approvals
### Change approval configuration
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/183) in GitLab 10.6.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
If you are allowed to, you can change `approvals_required` using the following
endpoint:
@@ -937,8 +950,7 @@ These are system generated rules.
## Approve Merge Request
-> - Introduced in GitLab 8.9.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
If you are allowed to, you can approve a merge request using the following
endpoint:
@@ -1001,8 +1013,7 @@ does not match, the response code is `409`.
## Unapprove Merge Request
-> - Introduced in GitLab 9.0.
-> - Moved to GitLab Premium in 13.9.
+> Moved to GitLab Premium in 13.9.
If you did approve a merge request, you can unapprove it using the following
endpoint: