Updated on 2025-03-28 GMT+08:00

Approving an MR

Function

Approve an MR.

URI

PUT /v2/repositories/{repository_id}/merge-requests/{merge_request_iid}/approval

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

String

Repository short ID.

merge_request_iid

Yes

Integer

Repository IID of the MR.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

action_type

Yes

String

Review type. The values can be approve, reject, and reset.

Request Parameters

Table 3 Request header 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

Table 4 Response body parameters

Parameter

Type

Description

result

Result object

Response result.

status

String

Response status.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error

Error object

Response error.

status

String

Response status.

Table 6 Error

Parameter

Type

Description

code

String

Error code.

message

String

Error message.

Table 7 Result

Parameter

Type

Description

id

Integer

Approver ID.

name

String

Approver name.

username

String

Approver username.

email

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

OK
{
    "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.