Help Center/ CodeArts Repo/ API Reference/ APIs/ Repository/ Obtaining MR Details of a Repository
Updated on 2025-03-28 GMT+08:00

Obtaining MR Details of a Repository

Function

This API is used to obtain MR details of a repository.

URI

GET /v2/repositories/{repository_id}/merge_request/{merge_request_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

Integer

Explanation:

Repository short ID.

Constraints:

Mandatory

Range:

0–2147483647

Default value:

None

merge_request_id

Yes

Integer

Explanation:

MR ID.

Constraints:

Mandatory

Range:

0–2147483647

Default value:

None

Request Parameters

Table 2 Request header parameters

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:

Mandatory

Range:

1–100,000 characters.

Default value:

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Explanation:

Response error code.

result

MergeInfoResult 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 4 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 5 MergeInfoResult

Parameter

Type

Description

approval_merge_request_approvers

Array of ApprovalMergeRequestApproversItem objects

Explanation:

Scorer.

author

Author object

Explanation:

Author.

closed_at

String

Explanation:

Closing time.

created_at

String

Explanation:

Creation time.

description

String

Explanation:

MR description.

devcloud_source_branch

String

Explanation:

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

is_source_branch_exist

Boolean

Explanation:

Whether the source branch exists.

merge_request_assignee_list

Array of MergeRequestAssigneeListItem objects

Explanation:

Reviewer.

merge_request_diff

MergeRequestDiff object

Explanation:

Merge differences.

merge_status

String

Explanation:

Whether an MR can be merged.

Range:

can_be_merged: Yes

cannot_be_merged: No

unchecked: Not yet checked

cannot_be_merged_recheck: No, and currently being checked

source_branch

String

Explanation:

Source branch.

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:

Target branch.

title

String

Explanation:

Title.

updated_at

String

Explanation:

Update time.

merged_at

String

Explanation:

Merging time.

merged_by

MergedByUser object

Explanation:

Merger.

merge_request_related_work_items

Array of MergeRequestRelatedWorkItem objects

Explanation:

Associated work items.

Table 6 ApprovalMergeRequestApproversItem

Parameter

Type

Description

id

Double

Explanation:

User ID.

name

String

Explanation:

Username.

nick_name

String

Explanation:

User alias.

state

String

Explanation:

User status.

username

String

Explanation:

IAM user ID.

Table 7 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.

Table 8 MergeRequestAssigneeListItem

Parameter

Type

Description

id

Double

Explanation:

User ID.

name

String

Explanation:

Username.

state

String

Explanation:

User status.

username

String

Explanation:

IAM user ID.

Table 9 MergeRequestDiff

Parameter

Type

Description

id

Double

Explanation:

MR difference ID.

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.

merge_request_id

Double

Explanation:

MR ID.

Range:

0–2147483647

created_at

String

Explanation:

Creation time.

updated_at

String

Explanation:

Update time.

base_commit_sha

String

Explanation:

Base commit.

real_size

Double

Explanation:

Actual size.

head_commit_sha

String

Explanation:

Head commit.

start_commit_sha

String

Explanation:

Start commit.

commits_count

Double

Explanation:

Number of commits.

external_diff

String

Explanation:

External differences.

external_diff_store

Double

Explanation:

External storage differences.

stored_externally

Boolean

Explanation:

Whether external storage exists.

added_lines

Double

Explanation:

Number of new lines.

removed_lines

Double

Explanation:

Number of deleted lines.

Table 10 MergedByUser

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:

Homepage URL.

Table 11 MergeRequestRelatedWorkItem

Parameter

Type

Description

id

Double

Explanation:

Work item ID.

user_id

String

Explanation:

User ID.

repo_id

Double

Explanation:

Repository ID.

merge_request_id

Double

Explanation:

MR ID.

target_branch

String

Explanation:

Target branch

source_branch

String

Explanation:

Source branch

merge_request_title

String

Explanation:

MR title

merge_request_url

String

Explanation:

MR URL

merge_request_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.

related_id

String

Explanation:

Associated work item ID.

related_title

String

Explanation:

Associated work item title

related_url

String

Explanation:

Associated work item URL

result

Double

Explanation:

Query result

create_at

String

Explanation:

Creation time.

update_at

String

Explanation:

Update time.

Example Requests

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

Example Responses

Status code: 200

OK

{
  "result" : {
    "iid" : 1,
    "approval_merge_request_approvers" : [ {
      "nick_name" : "emily",
      "name" : "emily",
      "id" : 7513,
      "state" : "optional",
      "username" : "0c1de3e61c80d56b1f7dc01164788784"
    }, {
      "nick_name" : "lmptest02",
      "name" : "lmptest02",
      "id" : 7745,
      "state" : "optional",
      "username" : "2ef8c2c835424e988ff33a8339ee1cb4"
    } ],
    "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-09T11:21:02.000+08:00",
    "id" : 6670,
    "state" : "opened",
    "closed_at" : "2021-12-08T16:34:50.000+08:00",
    "author" : {
      "name" : "repo",
      "id" : 6879,
      "state" : "active",
      "username" : "e0c068bf68c44bfab87b763ff85da277"
    },
    "is_source_branch_exist" : true,
    "target_branch" : "master",
    "merge_status" : "unchecked",
    "merge_request_diff" : {
      "merge_request_id" : 6670,
      "head_commit_sha" : "715fc146292edc31a588fbc74349a2b8d18dbc27",
      "updated_at" : "2021-12-09T11:20:58.000+08:00",
      "start_commit_sha" : "02f0482056d3b949699eb69683914466c84529af",
      "created_at" : "2021-12-09T11:20:58.000+08:00",
      "base_commit_sha" : "6e90282f6334433a9fe3be809a7c1eed1afbf10b",
      "commits_count" : 2
    },
    "devcloud_source_branch" : "branch123",
    "merge_request_assignee_list" : [ {
      "name" : "Flying snow in June",
      "id" : 6743,
      "state" : "active",
      "username" : "a618e34bd5704be3ae3395dfede06041"
    }, {
      "name" : "General administrator account",
      "id" : 6747,
      "state" : "active",
      "username" : "42dd0277cfb048dea856e4ee352e937d"
    } ],
    "merged_at" : "2023-08-14T20:51:51.000+08:00",
    "merged_by" : {
      "id" : "9124,",
      "name" : "CodeHub_beta_dev",
      "username" : "c369c68f1ff84679b5a8ed904d8bff1c",
      "state" : "active",
      "avatar_url" : "",
      "web_url" : "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c"
    },
    "merge_request_related_work_items" : [ {
      "id" : 7343,
      "user_id" : "9124",
      "repo_id" : 2111746921,
      "merge_request_id" : 20637,
      "target_branch" : "master",
      "source_branch" : "test123",
      "merge_request_url" : "https://test.com/codehub/2111746921/18/mergedetail?source=test123&target=master",
      "merge_request_state" : "opened",
      "related_id" : "6437435",
      "related_title" : "msm-0115-1000",
      "related_url" : "https://test.com/projectman/scrum/e76c13e86364438d9183ca2f395371e1/task/detail/6437435",
      "result" : 1,
      "create_at" : "2023-09-18T20:29:59.000+08:00",
      "update_at" : "2023-09-18T20:29:59.000+08:00"
    } ]
  },
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.