Obtaining the MR List of a Repository
Function
This API is used to obtain the MR list of a repository.
URI
GET /v2/repositories/{repository_id}/merge_request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repository_id |
Yes |
Integer |
Explanation: Repository short ID, which corresponds to Repository ID on the console. Constraints: Mandatory Range: 0–2147483647 Default value: None |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
state |
No |
String |
Explanation: MR status. Constraints: None 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. all: MRs in any status. Default value: all: MRs in any status. |
page |
No |
String |
Explanation: Page number. Constraints: None Range: A positive integer Default value: 1 |
per_page |
No |
Integer |
Explanation: Number of records 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
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
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:
|
Parameter |
Type |
Description |
---|---|---|
code |
String |
Explanation: Error code. Range: Max. 100 characters in the error code format. |
message |
String |
Explanation: Error message. Range: None |
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 |
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 yet checked cannot_be_merged_recheck: No, and currently being checked |
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. |
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 Codes
Status Code |
Description |
---|---|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.