From 70be63f936b01f4ae2f5e7deaadbc51ac082d90c Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Fri, 30 Aug 2019 14:35:13 +0800 Subject: Doc: Fix order of sections --- doc/api/merge_request_approvals.md | 162 ++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/doc/api/merge_request_approvals.md b/doc/api/merge_request_approvals.md index 7dae1b25658..b73fe38f53e 100644 --- a/doc/api/merge_request_approvals.md +++ b/doc/api/merge_request_approvals.md @@ -525,87 +525,6 @@ PUT /projects/:id/merge_requests/:merge_request_iid/approvers } ``` -## Approve Merge Request - ->**Note:** This API endpoint is only available on 8.9 Starter and above. - -If you are allowed to, you can approve a merge request using the following -endpoint: - -``` -POST /projects/:id/merge_requests/:merge_request_iid/approve -``` - -**Parameters:** - -| Attribute | Type | Required | Description | -|---------------------|---------|----------|-------------------------| -| `id` | integer | yes | The ID of a project | -| `merge_request_iid` | integer | yes | The IID of MR | -| `sha` | string | no | The HEAD of the MR | -| `approval_password` **(STARTER)** | string | no | Current user's password. Required if [**Require user password to approve**](../user/project/merge_requests/merge_request_approvals.md#require-authentication-when-approving-a-merge-request-starter) is enabled in the project settings. | - -The `sha` parameter works in the same way as -when [accepting a merge request](merge_requests.md#accept-mr): if it is passed, then it must -match the current HEAD of the merge request for the approval to be added. If it -does not match, the response code will be `409`. - -```json -{ - "id": 5, - "iid": 5, - "project_id": 1, - "title": "Approvals API", - "description": "Test", - "state": "opened", - "created_at": "2016-06-08T00:19:52.638Z", - "updated_at": "2016-06-09T21:32:14.105Z", - "merge_status": "can_be_merged", - "approvals_required": 2, - "approvals_left": 0, - "approved_by": [ - { - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", - "web_url": "http://localhost:3000/root" - } - }, - { - "user": { - "name": "Nico Cartwright", - "username": "ryley", - "id": 2, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/cf7ad14b34162a76d593e3affca2adca?s=80\u0026d=identicon", - "web_url": "http://localhost:3000/ryley" - } - } - ], -} -``` - -## Unapprove Merge Request - ->**Note:** This API endpoint is only available on 9.0 Starter and above. - -If you did approve a merge request, you can unapprove it using the following -endpoint: - -``` -POST /projects/:id/merge_requests/:merge_request_iid/unapprove -``` - -**Parameters:** - -| Attribute | Type | Required | Description | -|---------------------|---------|----------|---------------------| -| `id` | integer | yes | The ID of a project | -| `merge_request_iid` | integer | yes | The IID of MR | - ### Get merge request level rules >**Note:** This API endpoint is only available on 12.3 Starter and above. @@ -869,3 +788,84 @@ These are system generated rules. | `id` | integer | yes | The ID of a project | | `merge_request_iid` | integer | yes | The ID of MR | | `approval_rule_id` | integer | yes | The ID of a approval rule | + +## Approve Merge Request + +>**Note:** This API endpoint is only available on 8.9 Starter and above. + +If you are allowed to, you can approve a merge request using the following +endpoint: + +``` +POST /projects/:id/merge_requests/:merge_request_iid/approve +``` + +**Parameters:** + +| Attribute | Type | Required | Description | +|---------------------|---------|----------|-------------------------| +| `id` | integer | yes | The ID of a project | +| `merge_request_iid` | integer | yes | The IID of MR | +| `sha` | string | no | The HEAD of the MR | +| `approval_password` **(STARTER)** | string | no | Current user's password. Required if [**Require user password to approve**](../user/project/merge_requests/merge_request_approvals.md#require-authentication-when-approving-a-merge-request-starter) is enabled in the project settings. | + +The `sha` parameter works in the same way as +when [accepting a merge request](merge_requests.md#accept-mr): if it is passed, then it must +match the current HEAD of the merge request for the approval to be added. If it +does not match, the response code will be `409`. + +```json +{ + "id": 5, + "iid": 5, + "project_id": 1, + "title": "Approvals API", + "description": "Test", + "state": "opened", + "created_at": "2016-06-08T00:19:52.638Z", + "updated_at": "2016-06-09T21:32:14.105Z", + "merge_status": "can_be_merged", + "approvals_required": 2, + "approvals_left": 0, + "approved_by": [ + { + "user": { + "name": "Administrator", + "username": "root", + "id": 1, + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", + "web_url": "http://localhost:3000/root" + } + }, + { + "user": { + "name": "Nico Cartwright", + "username": "ryley", + "id": 2, + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/cf7ad14b34162a76d593e3affca2adca?s=80\u0026d=identicon", + "web_url": "http://localhost:3000/ryley" + } + } + ], +} +``` + +## Unapprove Merge Request + +>**Note:** This API endpoint is only available on 9.0 Starter and above. + +If you did approve a merge request, you can unapprove it using the following +endpoint: + +``` +POST /projects/:id/merge_requests/:merge_request_iid/unapprove +``` + +**Parameters:** + +| Attribute | Type | Required | Description | +|---------------------|---------|----------|---------------------| +| `id` | integer | yes | The ID of a project | +| `merge_request_iid` | integer | yes | The IID of MR | -- cgit v1.2.1