Approving an MR
Function
Approve an MR.
URI
PUT /v2/repositories/{repository_id}/merge-requests/{merge_request_iid}/approval
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | String | Repository short ID. |
| merge_request_iid | Yes | Integer | Repository IID of the MR. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| action_type | Yes | String | Review type. The values can be approve, reject, and reset. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| result | Result object | Response result. |
| status | String | Response status. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error | Error object | Response error. |
| status | String | Response status. |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Approver ID. |
| name | String | Approver name. |
| username | String | Approver username. |
| | String | Email. |
| state | String | Approval status. |
| updated_at | String | Update time. |
| avatar_url | String | Link address. |
Example Requests
PUT https://{endpoint}/v2/repositories/11111886/merge-requests/1/approval
{
"action_type" : "approval"
} Example Responses
Status code: 200
{
"id": 94895,
"name": "ming",
"username": "m012345",
"email": ",
"state": "reject",
"updated_at": "2024-08-16T15:25:57.208+08:00",
"avatar_url": ""
} Status code: 400
Bad Request
{
"error": {
"code": "CH.010001",
"message": "Invalid parameter"
},
"status": "failed"
} Status Code
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
Error code.
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.