Updated on 2026-01-27 GMT+08:00

Obtaining the Merge Request List (Deprecated)

Function

If a user is a member of a specified repository, the user can use this API to query the merge request list of the repository.

URI

GET /v2/repositories/{repository_id}/merge_request

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

Integer

Explanation

Repository ID. Go to the code page of the repository to view it.

Constraints

None.

Range

0–2147483647

Default value

None.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

state

No

String

Explanation

MR status.

Constraints

None.

Range

  • opened: The MR is open.
  • closed: The MR is closed.
  • merged: The MR has been merged.
  • locked: The MR is locked.
  • all: MRs in any status.

Default value

all

page

No

String

Explanation

Page index.

Constraints

None.

Range

1–2147483647

Default value

1

per_page

No

Integer

Explanation

Number of merge requests displayed on each page.

Constraints

None.

Range

0–2147483647

Default value

20

search

No

String

Explanation

Character string contained in MR titles or descriptions.

Constraints

None.

Range

Max. 100 characters.

Default value

None.

Request Parameters

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation

User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints

None.

Range

The length range of the character string is [1,100000].

Default value

None.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

error

Error object

Explanation

Response error code.

result

MergeResult object

Explanation

Response result.

status

String

Explanation

Response status of the API.

Range

  • success: The API call is successful.
  • failed: The API call failed.
Table 5 Error

Parameter

Type

Description

code

String

Explanation

Error code.

Range

Max. 100 characters in the error code format.

message

String

Explanation

Error message.

Range

None.

Table 6 MergeResult

Parameter

Type

Description

closed

Double

Explanation

Number of closed MRs.

Range

0–2147483647

merge_requests

Array of MergeRequestsItem objects

Explanation

MR list.

merged

Double

Explanation

Number of merged MRs.

Range

0–2147483647

opened

Double

Explanation

Number of open MRs.

Range

0–2147483647

total

Double

Explanation

Total number of MRs.

Range

0–2147483647

Table 7 MergeRequestsItem

Parameter

Type

Description

author

Author object

Explanation

MR author.

closed_at

String

Explanation

Time when an MR was closed.

created_at

String

Explanation

Time when an MR was created.

description

String

Explanation

MR description.

devcloud_source_branch

String

Explanation

MR source branch.

id

Double

Explanation

MR ID.

Range

0–2147483647

iid

Double

Explanation

Sequence number of an MR in the current repository.

Range

0–2147483647

merge_request_assignee_list

Array of Author objects

Explanation

MR reviewer information.

merge_status

String

Explanation

Whether an MR can be merged.

Range

  • can_be_merged: Yes
  • cannot_be_merged: No
  • unchecked: Not checked
  • cannot_be_merged_recheck: No, checking

source_branch

String

Explanation

MR source branch name.

state

String

Explanation

MR status.

Range

The value can be any one of the following:

  • opened: The MR is open.
  • closed: The MR is closed.
  • merged: The MR has been merged.
  • locked: The MR is locked.

target_branch

String

Explanation

MR target branch name.

title

String

Explanation

MR title.

updated_at

String

Explanation

Last update time of an MR.

Table 8 Author

Parameter

Type

Description

id

Double

Explanation

User ID.

name

String

Explanation

Username.

state

String

Explanation

User status.

username

String

Explanation

IAM user ID.

avatar_url

String

Explanation

Profile picture URL.

web_url

String

Explanation

Web URL.

Example Requests

GET https://{endpoint}/v2/repositories/907199/merge_request

Example Responses

Status code: 200

OK

{
  "result" : {
    "total" : 1,
    "merge_requests" : [ {
      "iid" : 1,
      "description" : "merge \"branch123\" into \"master\"\nCreate the dsadsad11 file",
      "created_at" : "2021-12-08T16:34:49.000+08:00",
      "title" : "tesafrds.",
      "source_branch" : "branch123",
      "updated_at" : "2021-12-08T16:39:24.000+08:00",
      "id" : 6670,
      "state" : "opened",
      "closed_at" : "2021-12-08T16:34:50.000+08:00",
      "author" : {
        "name" : "repo",
        "id" : 1234,
        "state" : "active",
        "username" : "e0c068bf68c44bfab87b763ff85da277"
      },
      "target_branch" : "master",
      "merge_status" : "can_be_merged",
      "devcloud_source_branch" : "branch123",
      "merge_request_assignee_list" : [ {
        "name" : "Example account",
        "id" : 3333,
        "state" : "active",
        "username" : "a618e34bd5704be3ae3395dfede06041"
      }, {
        "name" : "Example account",
        "id" : 6747,
        "state" : "active",
        "username" : "42dd0277cfb048dea856e4ee352e937d"
      } ]
    } ],
    "merged" : 0,
    "closed" : 0,
    "opened" : 1
  },
  "status" : "success"
}

Status Code

Status Code

Description

200

OK

Error Codes

See Error Codes.