ListMergeRequests

Updated at:

Queries a list of merge requests with support for pagination, sorting, and filtering. This API queries both legacy and new merge requests. If legacy merge requests were never used or no legacy merge request data exists, ignore the fields related to legacy merge requests in the response.

Operation description

Before calling this API, ensure that the current organization is using the new version of merge requests. You can verify this by checking whether the merge request page of the current organization displays the new version.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /api/v4/projects/merge_requests/advanced_search HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

organizationId

string

Yes

The organization ID. This string value can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId].

60de7a6852743a5162b5f957

accessToken

string

No

The personal access token. This parameter is not required if you use an Alibaba Cloud AccessKey pair or Security Token Service (STS) temporary authorization.

f0b1e61db5961df5975a93f9129d2513

page

integer

No

The page number. Default value: 1.

1

pageSize

integer

No

The number of entries per page. Default value: 20. Valid values: 1 to 100.

10

groupIds

string

No

The code group IDs. Separate multiple IDs with commas.

889910, 889911

projectIds

string

No

The code repository IDs. Separate multiple IDs with commas.

2308912, 2308913

authorIds

string

No

The Alibaba Cloud account IDs of the creators. Separate multiple IDs with commas.

1234567890

reviewerIds

string

No

The Alibaba Cloud account IDs of the reviewers. Separate multiple IDs with commas.

1234567890123

state

string

No

The status of the merge request. By default, merge requests in all states are queried. Valid values:

  • opened: Open. This includes the reviewing, pending merge, and pending development states.

  • closed: Closed.

  • merged: Merged.

  • all: All. If this value is specified, you can leave this parameter empty. Invalid characters also default to querying all states.

opened

search

string

No

The search keyword used to match the title of the merge request.

test-search

orderBy

string

No

The field used for sorting. Default value: updated_at. Valid values:

  • created_at: Creation time.

  • updated_at: Update time. If an invalid value is specified, updated_at is used by default.

updated_at

sort

string

No

The sort order. Default value: desc. Valid values:

  • desc: Descending order.

  • asc: Ascending order.

desc

filter

string

No

The filter used to filter merge requests of the new and legacy versions. By default, no filtering is applied, and both new and legacy versions are returned. If you have always used the new version of merge requests, you can ignore this parameter. Valid values:

  • new: Queries only new merge requests.

  • old: Queries only legacy merge requests.

new

labelIds

string

No

The label IDs. Separate multiple IDs with commas.

b5b5738b94954bc6aa5a293316ed1d24

createdBefore

string

No

The start time for creation.

Note

Specify the time in ISO 8601 format, such as 2019-03-15T08:00:00Z. The comparison condition is "greater than or equal to".

2019-03-15T08:00:00Z

createdAfter

string

No

The end time for creation.

Note

Specify the time in ISO 8601 format, such as 2019-03-15T08:00:00Z. The comparison condition is "less than". The creation time range is [createdBefore, createdAfter), which is a left-closed and right-open interval.

2019-03-15T08:00:00Z

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

The request ID.

ASSDS-ASSASX-XSAXSA-XSAXSAXS

errorCode

string

The error code.

Openapi.RequestError

errorMessage

string

The error message.

""

success

boolean

Indicates whether the call was successful.

true

total

integer

The total number of records.

30

result

array<object>

The list of returned results.

array<object>

The merge request information.

newMergeRequestIdentifier

boolean

The identifier for new and legacy merge requests. A value of true indicates the new version, and a value of false indicates the legacy version.

true

projectId

integer

The ID of the code repository.

2369234

id

integer

The ID of the legacy merge request. This value is empty if the current merge request is of the new version.

1

iid

integer

The local ID of the merge request, which indicates the sequence number of the merge request in the code repository. This value is empty if the merge request is of the new version.

1

mrBizId

string

The unique ID of the new merge request. This value is available only for new merge requests.

bca90244c4b749e0b109df52ac0eb570

localId

integer

The local ID of the merge request, which indicates the sequence number of the merge request in the code repository. This field is used for new merge requests.

2

title

string

The title of the merge request.

test-merge request title

description

string

The description of the merge request.

Specific content of the description

state

string

The status of the legacy merge request. Valid values:

  • opened: opened

  • reopened: reopened

  • closed: closed

  • accepted: approved but not merged

  • merged: approved and merged

  • locked: locked for merging

opened

newVersionState

string

The status of the new merge request. Valid values:

  • UNDER_DEV: under development

  • UNDER_REVIEW: under review

  • TO_BE_MERGED: to be merged

  • CLOSED: closed

  • MERGED: merged

UNDER_REVIEW

createdAt

string

The creation time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-18 14:24:54

updatedAt

string

The update time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-18 14:24:54

sourceBranch

string

The source branch.

test-merge-source-branch

targetBranch

string

The target branch.

test-merge-target-branch

author

object

The author information.

id

integer

The user ID in Codeup.

19927

name

string

The name of the user.

test-codeup

username

string

The logon name of the user.

root-test-codeup

state

string

The user status. Valid values:

  • active: active

  • blocked: deprecated or unavailable

active

avatarUrl

string

The URL of the avatar.

https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100

email

string

The email address of the user.

username@example.com

reviewers

array<object>

The list of reviewers.

object

The reviewer information.

id

integer

The user ID in Codeup.

43127

name

string

The name of the user.

test-review-user

username

string

The logon name of the user.

root-test-review-user

state

string

The user status. Valid values:

  • active: active

  • blocked: deprecated or unavailable

active

avatarUrl

string

The URL of the reviewer's avatar.

https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100

email

string

The email address of the user.

username@example.com

status

string

The reviewer status. Valid values:

  • approved: approved

  • comment: commented

  • pending: pending

approved

reviewTime

string

The time when the reviewer completed the review.

Note

This field is valid only for new merge requests. This field is returned only after the reviewer completes the review. Otherwise, this field is empty. The format is YYYY-MM-DD HH:mm:ss.

2022-03-18 14:24:54

hasReviewed

boolean

Indicates whether the reviewer has reviewed the merge request.

false

hasCommented

boolean

Indicates whether the reviewer has commented.

true

reviewOpinionStatus

string

The review opinion. This field is empty if the merge request is not reviewed. Valid values:

  • PASS: pass

  • NOT_PASS: not passed

PASS

subscribers

array<object>

The list of subscribers.

object

The subscriber information.

id

integer

The user ID in Codeup.

1876119

name

string

The name of the user.

test-subscriber

username

string

The logon name of the user.

root-test-subscriber

state

string

The user status. Valid values:

  • active: active

  • blocked: deprecated or unavailable

active

avatarUrl

string

The URL of the avatar.

https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100

email

string

The email address of the user.

username@example.com

sourceProjectId

integer

The ID of the source code repository.

2876119

targetProjectId

integer

The ID of the target code repository.

2876119

workInProgress

boolean

Indicates whether the merge request is a work in progress.

false

detailUrl

string

The URL of the merge request details.

https://example.com/org/demo-repo/change/1

webUrl

string

The URL for web access.

""

sshUrl

string

The SSH clone URL of the code repository.

git@xxx:xxx/test/test.git

creationMethod

string

The creation method. Valid values:

  • WEB: created by using the web UI

  • COMMAND_LINE: created by using the command line

WEB

sourceType

string

The source type. For legacy merge requests, valid values:

  • BRANCH: branch

  • COMMIT: commit

For new merge requests, valid values:

  • BRANCH: branch

  • REF: commit or reference review

BRANCH

targetType

string

The target type. Typically, the value is BRANCH.

BRANCH

nameWithNamespace

string

The full name of the code repository, including the full group name.

codeup-test-org / test-create-group (with spaces on both sides of the slash)

supportMergeFFOnly

boolean

Indicates whether the fast-forward-only merge method is supported.

true

labels

array<object>

The list of labels.

object

The label information.

id

string

The label ID, which is a unique identifier.

b5b5738b94954bc6aa5a293316ed1d24

name

string

The label name.

New feature

color

string

The label color.

#006AD4

description

string

The label description.

New feature or requirement

mergedRevision

string

The merged revision (commit SHA).

1a072f5367c21f9de3464b8c0ee8546e47764d2d

Examples

Success response

JSON format

{
  "requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
  "errorCode": "Openapi.RequestError",
  "errorMessage": "\"\"",
  "success": true,
  "total": 30,
  "result": [
    {
      "newMergeRequestIdentifier": true,
      "projectId": 2369234,
      "id": 1,
      "iid": 1,
      "mrBizId": "bca90244c4b749e0b109df52ac0eb570",
      "localId": 2,
      "title": "test-merge request title",
      "description": "Specific content of the description",
      "state": "opened",
      "newVersionState": "UNDER_REVIEW",
      "createdAt": "2022-03-18 14:24:54",
      "updatedAt": "2022-03-18 14:24:54",
      "sourceBranch": "test-merge-source-branch",
      "targetBranch": "test-merge-target-branch",
      "author": {
        "id": 19927,
        "name": "test-codeup",
        "username": "root-test-codeup",
        "state": "active",
        "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
        "email": "username@example.com"
      },
      "reviewers": [
        {
          "id": 43127,
          "name": "test-review-user",
          "username": "root-test-review-user",
          "state": "active",
          "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
          "email": "username@example.com",
          "status": "approved",
          "reviewTime": "2022-03-18 14:24:54",
          "hasReviewed": false,
          "hasCommented": true,
          "reviewOpinionStatus": "PASS"
        }
      ],
      "subscribers": [
        {
          "id": 1876119,
          "name": "test-subscriber",
          "username": "root-test-subscriber",
          "state": "active",
          "avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
          "email": "username@example.com"
        }
      ],
      "sourceProjectId": 2876119,
      "targetProjectId": 2876119,
      "workInProgress": false,
      "detailUrl": "xxx",
      "webUrl": "\"\"",
      "sshUrl": "git@xxx:xxx/test/test.git",
      "creationMethod": "WEB",
      "sourceType": "BRANCH",
      "targetType": "BRANCH",
      "nameWithNamespace": "codeup-test-org / test-create-group (with spaces on both sides of the slash)",
      "supportMergeFFOnly": true,
      "labels": [
        {
          "id": "b5b5738b94954bc6aa5a293316ed1d24",
          "name": "New feature",
          "color": "#006AD4",
          "description": "New feature or requirement"
        }
      ],
      "mergedRevision": "1a072f5367c21f9de3464b8c0ee8546e47764d2d"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.