Merge requests API
GitLab v19.1- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated reference는 GitLab 12.7에서 폐기되었습니다. merged_by는 GitLab 14.7에서 폐기되었습니다.
Merge requests API#
-
Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
History
-
reference는 GitLab 12.7에서 폐기되었습니다. -
merged_by는 GitLab 14.7에서 폐기되었습니다. -
merge_status는 GitLab 15.6에서detailed_merge_status를 위해 폐기되었습니다. -
with_merge_status_recheck는 GitLab 15.11에서 변경되었으며,restrict_merge_status_recheck라는 이름의 플래그를 통해 권한이 부족한 사용자의 요청은 무시됩니다. 기본적으로 비활성화되어 있습니다. -
approvals_before_merge는 GitLab 16.0에서 폐기되었습니다. -
prepared_at은 GitLab 16.1에서 도입되었습니다. -
merge_user_id는 GitLab 17.0에서 도입되었습니다. -
merge_user_username은 GitLab 17.0에서 도입되었습니다. -
order_by의merged_at값은 GitLab 17.2에서 도입되었습니다. -
merge_after는 GitLab 17.5에서 도입되었습니다. -
security_policy_violations는 GitLab 18.4에서 일반적으로 사용 가능해졌습니다. 피처 플래그policy_mergability_check가 제거되었습니다. -
draft필터 파라미터는 GitLab 19.0에서 도입되었습니다. -
wip필터 파라미터는 GitLab 19.0에서 폐기되었습니다.
이 API를 사용하여 머지 리퀘스트를 관리하세요. 다음을 수행할 수 있습니다:
-
코드 리뷰 프로세스의 모든 부분을 자동화합니다.
-
코드 변경 사항을 외부 도구와 연결합니다.
-
머지 리퀘스트 정보를 원하는 형식으로 GitLab 외부 시스템에 전송합니다.
-
외부 시스템의 데이터를 기반으로 머지 리퀘스트를 업데이트, 승인, 병합 또는 차단합니다.
공개되지 않은 정보에 대한 모든 API 호출에는 인증이 필요합니다.
API v5에서의 제거 사항#
approvals_before_merge 속성은 폐기 예정이며, 머지 리퀘스트 승인 API를 위해 API v5에서 제거될 예정입니다.
머지 리퀘스트 목록 조회#
인증된 사용자가 접근 가능한 모든 머지 리퀘스트를 나열합니다. 기본적으로 현재 사용자가 생성한 머지 리퀘스트만 반환합니다.
모든 머지 리퀘스트를 검색하려면 scope=all을 사용하세요.
state 파라미터를 사용하여 특정 상태(opened, closed, locked, merged)의 머지 리퀘스트만 가져오거나 모든 상태(all)를 가져오세요.
locked 상태로 검색하면 해당 상태가 짧고 전환적이기 때문에 일반적으로 결과가 반환되지 않습니다. 페이지네이션 파라미터 page와
per_page를 사용하여 머지 리퀘스트 목록을 제한하세요.
GET /merge_requests
GET /merge_requests?state=opened
GET /merge_requests?state=all
GET /merge_requests?milestone=release
GET /merge_requests?labels=bug,reproduced
GET /merge_requests?author_id=5
GET /merge_requests?author_username=gitlab-bot
GET /merge_requests?my_reaction_emoji=star
GET /merge_requests?scope=assigned_to_me
GET /merge_requests?scope=reviews_for_me
GET /merge_requests?search=foo&in=title
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| approved_by_ids[] | integer array | No | 지정된 id를 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환합니다. Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approved_by_usernames[] | string array | No | 지정된 username을 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환합니다. Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approver_ids[] | integer array | No | 승인 규칙에 따라 지정된 id를 가진 모든 사용자가 적합한 승인자로 등록된 머지 리퀘스트를 반환합니다. None은 적합한 승인자가 없는 머지 리퀘스트를 반환합니다. Any는 적합한 승인자가 한 명 이상 있는 머지 리퀘스트를 반환합니다. Premium 및 Ultimate 전용입니다. |
| assignee_id | integer or string | No | 지정된 사용자 id에 할당된 머지 리퀘스트를 반환합니다. None은 미할당 머지 리퀘스트를 반환합니다. Any는 담당자가 있는 머지 리퀘스트를 반환합니다. assignee_username과 상호 배타적입니다. |
| assignee_username[] | string array | No | 지정된 username에 할당된 머지 리퀘스트를 반환합니다. assignee_id와 상호 배타적입니다. |
| author_id | integer | No | 지정된 사용자 id가 생성한 머지 리퀘스트를 반환합니다. author_username과 상호 배타적입니다. scope=all 또는 scope=assigned_to_me와 조합하여 사용하세요. |
| author_username | string | No | 지정된 username이 생성한 머지 리퀘스트를 반환합니다. author_id와 상호 배타적입니다. |
| created_after | datetime | No | 지정된 날짜 및 시간 이후에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| created_before | datetime | No | 지정된 날짜 및 시간 이전에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| deployed_after | datetime | No | 지정된 날짜/시간 이후에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| deployed_before | datetime | No | 지정된 날짜/시간 이전에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| environment | string | No | 지정된 환경에 배포된 머지 리퀘스트를 반환합니다. |
| in | string | No | 검색 속성의 범위를 변경합니다. title, description 또는 쉼표로 구분된 두 값의 조합. 기본값은 title,description입니다. |
| labels | string | No | 쉼표로 구분된 라벨 목록과 일치하는 머지 리퀘스트를 반환합니다. None은 라벨이 없는 모든 머지 리퀘스트를 나열합니다. Any는 라벨이 하나 이상 있는 모든 머지 리퀘스트를 나열합니다. 미리 정의된 이름은 대소문자를 구분하지 않습니다. |
| merge_user_id | integer | No | 지정된 사용자 id를 가진 사용자가 병합한 머지 리퀘스트를 반환합니다. merge_user_username과 상호 배타적입니다. GitLab 17.0에서 도입되었습니다. |
| merge_user_username | string | No | 지정된 username을 가진 사용자가 병합한 머지 리퀘스트를 반환합니다. merge_user_id와 상호 배타적입니다. GitLab 17.0에서 도입되었습니다. |
| milestone | string | No | 특정 마일스톤의 머지 리퀘스트를 반환합니다. None은 마일스톤이 없는 머지 리퀘스트를 반환합니다. Any는 마일스톤이 할당된 머지 리퀘스트를 반환합니다. |
| my_reaction_emoji | string | No | 인증된 사용자가 지정된 이모지로 반응한 머지 리퀘스트를 반환합니다. None은 반응이 없는 이슈를 반환합니다. Any는 반응이 하나 이상 있는 이슈를 반환합니다. |
| non_archived | boolean | No | true이면 아카이브되지 않은 프로젝트의 머지 리퀘스트만 반환합니다. 기본값은 false입니다. |
| not | hash | No | 지정된 파라미터와 일치하지 않는 머지 리퀘스트를 반환합니다. 허용되는 값: labels, milestone, author_id, author_username, assignee_id, assignee_username, reviewer_id, reviewer_username, my_reaction_emoji. |
| order_by | string | No | created_at, updated_at, merged_at(GitLab 17.2에서 도입), label_priority, priority, milestone_due, popularity 또는 title 필드로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 created_at입니다. |
| reviewer_id | integer or string | No | 지정된 사용자 id를 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환합니다. Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_username과 상호 배타적입니다. |
| reviewer_username | string | No | 지정된 username을 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환합니다. Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_id와 상호 배타적입니다. |
| scope | string | No | 지정된 범위의 머지 리퀘스트를 반환합니다: created_by_me, assigned_to_me, reviews_for_me 또는 all. reviews_for_me는 현재 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. 기본값은 created_by_me입니다. |
| search | string | No | 머지 리퀘스트의 제목 및 설명을 검색합니다. in 속성과 조합하여 사용하세요. |
| sort | string | No | asc 또는 desc 순서로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 desc입니다. |
| source_branch | string | No | 지정된 소스 브랜치가 있는 머지 리퀘스트를 반환합니다. | | state | string | No | 모든 머지 리퀘스트(all)를 반환하거나, opened, closed, locked, 또는 merged 상태인 것만 반환합니다. 기본값은 all입니다. | | target_branch | string | No | 지정된 타깃 브랜치가 있는 머지 리퀘스트를 반환합니다. | | updated_after | datetime | No | 지정된 날짜 및 시간 이후에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. | | updated_before | datetime | No | 지정된 날짜 및 시간 이전에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. | | view | string | No | simple로 설정하면 머지 리퀘스트의 iid, URL, 제목, 설명, 기본 상태만 반환합니다. | | draft | boolean | No | 머지 리퀘스트를 Draft 상태로 필터링합니다. true는 Draft 머지 리퀘스트만 반환하고, false는 Draft가 아닌 머지 리퀘스트를 반환합니다. wip과 상호 배타적입니다. | | wip | string | No | GitLab 19.0에서 deprecated되었습니다. 대신 draft를 사용하세요. 머지 리퀘스트를 wip 상태로 필터링합니다. yes는 Draft 머지 리퀘스트만 반환하고, no는 Draft가 아닌 머지 리퀘스트를 반환합니다. | | with_labels_details | boolean | No | true이면 응답에서 labels 필드의 각 라벨에 대한 추가 세부 정보(:name, :color, :description, :description_html, :text_color)를 반환합니다. 기본값은 false입니다. | | with_merge_status_recheck | boolean | No | true이면 이 프로젝션이 merge_status 필드의 비동기 재계산을 요청합니다(단, 보장하지는 않습니다). restrict_merge_status_recheck 기능 플래그를 활성화하면 Developer, Maintainer 또는 Owner 권한이 없는 사용자가 요청할 때 이 속성이 무시됩니다. |
성공하면 200 OK를 반환합니다. view가 simple로 설정된 경우 필드의 서브셋을 반환합니다. 그 외의 경우 응답 속성에는 다음이 포함됩니다:
| Attribute | Type | Description |
|---|---|---|
| allow_collaboration | boolean | true이면 이 포크가 타깃 브랜치에 머지할 수 있는 구성원의 협업을 허용합니다. 포크에서 생성된 머지 리퀘스트에만 사용됩니다. |
| allow_maintainer_to_push | boolean | Deprecated. 대신 allow_collaboration을 사용하세요. |
| approvals_before_merge | integer | GitLab 16.0에서 deprecated되었습니다. 승인 규칙을 구성하려면 머지 리퀘스트 승인 API를 참조하세요. GitLab Premium 및 Ultimate 전용입니다. |
| assignee[] | object | Deprecated. 대신 assignees를 사용하세요. |
| assignees[] | array | 머지 리퀘스트에 할당된 사용자 목록입니다. |
| assignees.avatar_url | string | 담당자의 아바타 이미지 전체 URL입니다. |
| assignees.id | integer | 담당자의 고유 ID입니다. |
| assignees.locked | boolean | true이면 담당자의 계정이 인증 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| assignees.name | string | 담당자의 표시 이름입니다. 현재 사용자의 권한에 따라 일부 가려질 수 있습니다. |
| assignees.public_email | string | 담당자의 공개 이메일 주소입니다. |
| assignees.state | string | 담당자 사용자 계정의 현재 상태입니다. 가능한 값: active, blocked, 또는 deactivated. |
| assignees.username | string | 머지 리퀘스트 담당자의 사용자 이름입니다. |
| assignees.web_url | string | 담당자의 프로필 페이지 전체 URL입니다. |
| author[] | object | 머지 리퀘스트를 생성한 사용자 정보가 담긴 객체입니다. |
| author.avatar_url | string | 작성자의 아바타 이미지 전체 URL입니다. |
| author.id | integer | 머지 리퀘스트를 생성한 사용자의 고유 ID입니다. |
| author.locked | boolean | true이면 작성자의 계정이 인증 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| author.name | string | 작성자의 표시 이름입니다. 현재 사용자의 권한에 따라 일부 가려질 수 있습니다. |
| author.public_email | string | 작성자의 공개 이메일 주소입니다. |
| author.state | string | 사용자 계정의 현재 상태입니다. 가능한 값: active, blocked, 또는 deactivated. |
| author.username | string | 머지 리퀘스트 작성자의 사용자 이름입니다. |
| author.web_url | string | 작성자의 프로필 페이지 전체 URL입니다. |
| blocking_discussions_resolved | boolean | true이면 머지 리퀘스트의 모든 토론 스레드가 머지 전에 해결되어야 합니다. |
| closed_at | dateTime | 머지 리퀘스트가 닫힌 시간의 타임스탬프입니다. |
| closed_by[] | object | 머지 리퀘스트를 닫은 사용자 정보가 담긴 객체입니다. null이면 머지 리퀘스트가 열려 있습니다. |
| closed_by.avatar_url | string | 머지 리퀘스트를 닫은 사용자의 아바타 이미지 전체 URL입니다. |
| closed_by.id | integer | 머지 리퀘스트를 닫은 사용자의 고유 ID입니다. |
| closed_by.locked | boolean | true이면 해당 사용자의 계정이 인증 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| closed_by.name | string | 머지 리퀘스트를 닫은 사용자의 표시 이름입니다. 현재 사용자의 권한에 따라 일부 가려질 수 있습니다. |
| closed_by.public_email | string | 머지 리퀘스트를 닫은 사용자의 공개 이메일 주소입니다. |
| closed_by.state | string | 머지 리퀘스트를 닫은 사용자 계정의 현재 상태입니다. 가능한 값: active, blocked, 또는 deactivated. |
| closed_by.username | string | 머지 리퀘스트를 닫은 사용자의 사용자 이름입니다. |
| closed_by.web_url | string | 머지 리퀘스트를 닫은 사용자의 프로필 페이지 전체 URL입니다. |
| created_at | dateTime | 머지 리퀘스트가 생성된 시간의 타임스탬프입니다. |
| description | string | 머지 리퀘스트의 설명입니다. 캐시를 위해 HTML로 렌더링된 Markdown을 포함합니다. |
| description_html | string | render_html이 설정된 경우 설명의 렌더링된 HTML 버전입니다. |
| detailed_merge_status | string | 상세 머지 상태 정보입니다. 가능한 값 목록은 merge status를 참조하세요. |
| discussion_locked | boolean | true이면 토론이 잠겨 있습니다. 잠긴 토론에서는 프로젝트 구성원만 댓글을 추가, 편집 또는 해결할 수 있습니다. |
| downvotes | integer | 머지 리퀘스트의 반대 투표 수입니다. |
| draft | boolean | true이면 머지 리퀘스트가 Draft 상태로 표시됩니다. |
| force_remove_source_branch | boolean | true이면 프로젝트 설정에 의해 머지 후 소스 브랜치가 강제로 삭제됩니다. |
| has_conflicts | boolean | true이면 머지 리퀘스트에 충돌이 있어 머지할 수 없습니다. merge_status 속성에 종속됩니다. merge_status가 cannot_be_merged인 경우에만 false가 아닌 값을 반환합니다. |
| id | integer | 머지 리퀘스트의 고유 ID입니다. |
| iid | integer | 프로젝트 내 머지 리퀘스트의 내부 ID입니다. |
| imported | boolean | true이면 머지 리퀘스트가 임포트된 것입니다. |
| imported_from | string | Bitbucket 등 임포트 출처입니다. |
| labels[] | array | 머지 리퀘스트에 할당된 라벨 배열입니다. with_labels_details가 true이면 각 라벨에 대한 배열을 반환합니다. |
| labels.archived | boolean | with_labels_details가 true이면 라벨의 보관 여부를 나타냅니다. |
| labels.color | string | with_labels_details가 true이면 라벨의 배경 색상입니다. |
| labels.description | string | with_labels_details가 true이면 라벨의 설명 텍스트입니다. null이면 라벨에 설명이 없습니다. |
| labels.description_html. | string | with_labels_details가 true이면 라벨의 HTML 렌더링 설명입니다. null이면 라벨에 설명이 없습니다. |
| labels.id | integer | with_labels_details가 true이면 라벨의 고유 ID입니다. |
| labels.name | string | with_labels_details가 true이면 라벨의 이름입니다. |
| labels.text_color | string | with_labels_details가 true이면 라벨의 텍스트 색상입니다. |
| merge_after | dateTime | 설정된 경우, 머지 리퀘스트를 머지할 수 있는 날짜 및 시간 이후의 타임스탬프입니다. GitLab 17.8에서 도입되었습니다. |
| merge_commit_sha | string | 설정된 경우, 머지 리퀘스트 커밋의 SHA입니다. 머지되기 전까지 null을 반환합니다. |
| merge_status | string | 머지 리퀘스트의 상태입니다. 모든 잠재적 상태를 고려하는 detailed_merge_status를 대신 사용하세요. has_conflicts 속성에 영향을 줍니다. 응답 데이터에 대한 중요 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 참조하세요. GitLab 15.6에서 deprecated되었습니다. |
| merge_user | object | 머지 리퀘스트를 머지했거나 자동 머지로 설정한 사용자 정보가 담긴 객체이거나 null입니다. |
| merge_when_pipeline_succeeds | boolean | true이면 머지 리퀘스트가 자동 머지로 설정되어 있습니다. |
| merged_at | dateTime | 머지 리퀘스트가 머지된 시간의 타임스탬프입니다. |
| merged_by[] | object | Deprecated. 대신 merge_user를 사용하세요. |
| milestone[] | object | 머지 리퀘스트에 할당된 마일스톤 정보가 담긴 객체입니다. |
| milestone.created_at | dateTime | 마일스톤이 생성된 시간의 타임스탬프입니다. |
| milestone.description | string | 마일스톤의 설명 텍스트입니다. null이면 마일스톤에 설명이 없습니다. |
| milestone.due_date | date | 마일스톤의 마감일입니다. null이면 마일스톤에 마감일이 없습니다. |
| milestone.expired | boolean | true이면 마일스톤이 만료되었습니다. |
| milestone.group_id | integer | 마일스톤이 속한 그룹의 ID입니다. 그룹 마일스톤인 경우에만 포함됩니다. |
| milestone.id | integer | 마일스톤의 고유 ID입니다. |
| milestone.iid | integer | 프로젝트 또는 그룹 내 마일스톤의 내부 ID입니다. |
| milestone.project_id | integer | 마일스톤이 속한 프로젝트의 ID입니다. 프로젝트 마일스톤인 경우에만 포함됩니다. |
| milestone.start_date | date | 마일스톤의 시작일입니다. null이면 마일스톤에 시작일이 없습니다. |
| milestone.state | string | 마일스톤의 현재 상태입니다(예: active 또는 closed). |
| milestone.title | string | 마일스톤의 이름입니다. |
| milestone.updated_at | dateTime | 마일스톤이 마지막으로 업데이트된 시간의 타임스탬프입니다. |
| milestone.web_url | string | 마일스톤을 볼 수 있는 전체 웹 URL입니다. |
| prepared_at | dateTime | 머지 리퀘스트가 준비된 시간의 타임스탬프입니다. 이 필드는 모든 준비 단계가 완료된 후 한 번만 채워지며, 추가 변경이 있더라도 업데이트되지 않습니다. |
| project_id | integer | 머지 리퀘스트가 포함된 프로젝트의 ID입니다. |
| reference | string | Deprecated. 대신 references를 사용하세요. |
| references[] | object | 머지 리퀘스트의 모든 내부 참조가 담긴 객체입니다. |
| references.full | string | gitlab-org/gitlab!123과 같이 전체 프로젝트 경로를 포함한 머지 리퀘스트의 완전한 참조입니다. 그룹 또는 프로젝트 간에 요청되는 경우 references.relative와 동일합니다. |
| references.relative | string | 특정 프로젝트 또는 그룹에 대한 상대적 참조입니다. 현재 프로젝트의 머지 리퀘스트는 !123, 같은 그룹 내 다른 프로젝트는 other-project!123으로 표시됩니다. |
| references.short | string | !123과 같이 머지 리퀘스트에 대한 가장 짧은 참조입니다. 머지 리퀘스트의 프로젝트에서 가져오는 경우 references.relative와 동일합니다. |
| reviewers[] | array | 머지 리퀘스트의 리뷰어 목록입니다. |
| reviewers.avatar_url | string | 리뷰어의 아바타 이미지 전체 URL입니다. |
| reviewers.id | integer | 리뷰어의 고유 ID입니다. |
| reviewers.locked | boolean | true이면 리뷰어의 계정이 인증 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| reviewers.name | string | 리뷰어의 표시 이름입니다. 현재 사용자의 권한에 따라 일부 가려질 수 있습니다. |
| reviewers.public_email | string | 리뷰어의 공개 이메일 주소입니다. |
| reviewers.state | string | 리뷰어 사용자 계정의 현재 상태입니다. 가능한 값: active, blocked, 또는 deactivated. |
| reviewers.username | string | 머지 리퀘스트 리뷰어의 사용자 이름입니다. |
| reviewers.web_url | string | 리뷰어의 프로필 페이지 전체 URL입니다. |
| sha | string | 소스 브랜치의 head 커밋 SHA입니다. |
| should_remove_source_branch | boolean | true이면 머지 후 소스 브랜치가 삭제됩니다. |
| source_branch | string | 소스 브랜치의 이름입니다. |
| source_project_id | integer | 소스 프로젝트의 ID입니다. |
| squash | boolean | true이면 머지 시 커밋을 스쿼시합니다. |
| squash_commit_sha | string | 설정된 경우, 스쿼시 커밋의 SHA입니다. 머지되기 전까지 비어 있습니다. |
| squash_on_merge | boolean | true이면 머지 시 커밋이 스쿼시됩니다. |
| state | string | 머지 리퀘스트의 현재 상태입니다. 가능한 값: opened, closed, merged, 또는 locked. |
| target_branch | string | 타깃 브랜치의 이름입니다. |
| target_project_id | integer | 타깃 프로젝트의 ID입니다. |
| task_completion_status[] | object | 작업 목록 완료 상태 정보가 담긴 객체입니다. |
| task_completion_status.completed_count | integer | 머지 리퀘스트 설명에서 완료된 작업 목록 항목의 수입니다. 머지 리퀘스트에 설명이 없거나 작업 목록 항목이 없으면 0을 반환합니다. |
| task_completion_status.count | integer | 머지 리퀘스트 설명에서 발견된 태스크 목록 항목의 총 수. 머지 리퀘스트에 설명이 없거나 태스크 목록 항목이 없으면 0을 반환합니다. | | time_stats[] | object | 이 머지 리퀘스트의 시간 추적 정보를 담은 오브젝트. | | time_stats.human_time_estimate | string | time_stats.time_estimate의 사람이 읽을 수 있는 형식(예: 3h 30m). | | time_stats.human_total_time_spent | string | time_stats.total_time_spent의 사람이 읽을 수 있는 형식(예: 3h 30m). | | time_stats.time_estimate | integer | 머지 리퀘스트 완료에 필요한 예상 시간(초 단위). | | time_stats.total_time_spent | integer | 머지 리퀘스트 작업에 소요된 총 시간(초 단위). | | title | string | 머지 리퀘스트 제목. | | title_html | string | render_html이 true이면 제목의 렌더링된 HTML 버전. | | updated_at | dateTime | 머지 리퀘스트가 마지막으로 업데이트된 시각의 타임스탬프. | | upvotes | integer | 머지 리퀘스트에 대한 업보트 수. | | user_notes_count | integer | 사용자 댓글 수. | | web_url | string | 머지 리퀘스트를 확인할 수 있는 웹 URL. | | work_in_progress | boolean | 더 이상 사용되지 않습니다. 대신 draft를 사용하세요. |
기타 가능한 응답:
-
401 Unauthorized— 액세스 토큰이 유효하지 않은 경우. -
408 Request Timeout— 데이터베이스 쿼리 시간이 초과된 경우. -
422 Unprocessable Entity— 유효성 검사에 실패한 경우. -
429 Too Many Requests—search파라미터를 사용 중이고 요청이 속도 제한에 걸린 경우.
응답 예시:
[
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"imported": false,
"imported_from": "none",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"id": 2,
"name": "Sam Bauch",
"username": "kenyatta_oconnell",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/956c92487c6f6f7616b536927e22c9a0?s=80&d=identicon",
"web_url": "http://gitlab.example.com//kenyatta_oconnell"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "my-group/my-project!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
]
머지 리퀘스트 목록 응답 참고 사항#
-
머지 리퀘스트 목록 조회 시
merge_status(has_conflicts에도 영향)가 자동으로 업데이트되지 않을 수 있습니다. 이 작업은 비용이 많이 들 수 있기 때문입니다. 이 엔드포인트에서 해당 필드 값이 필요하다면 쿼리에서with_merge_status_recheck파라미터를true로 설정하세요. -
머지 리퀘스트 객체 필드에 대한 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 참조하세요.
프로젝트 머지 리퀘스트 목록 조회#
프로젝트의 모든 머지 리퀘스트를 나열합니다.
GET /projects/:id/merge_requests
GET /projects/:id/merge_requests?state=opened
GET /projects/:id/merge_requests?state=all
GET /projects/:id/merge_requests?iids[]=42&iids[]=43
GET /projects/:id/merge_requests?milestone=release
GET /projects/:id/merge_requests?labels=bug,reproduced
GET /projects/:id/merge_requests?my_reaction_emoji=star
지원되는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| iids[] | integer array | 아니요 | 제공된 IID와 일치하는 머지 리퀘스트를 반환합니다. |
| approved_by_ids[] | integer array | 아니요 | 주어진 id를 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환하고, Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approved_by_usernames[] | string array | 아니요 | 주어진 사용자명을 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환하고, Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approver_ids[] | integer array | 아니요 | 승인 규칙에 따라 지정된 id를 가진 모든 사용자가 적격 승인자로 등록된 머지 리퀘스트를 반환합니다. None은 적격 승인자가 없는 머지 리퀘스트를 반환하고, Any는 적격 승인자가 한 명 이상 있는 머지 리퀘스트를 반환합니다. Premium 및 Ultimate 전용. |
| assignee_id | integer 또는 string | 아니요 | 주어진 사용자 id에 할당된 머지 리퀘스트를 반환합니다. None은 미할당 머지 리퀘스트를 반환하고, Any는 담당자가 있는 머지 리퀘스트를 반환합니다. assignee_username과 함께 사용할 수 없습니다. |
| assignee_username[] | string array | 아니요 | 주어진 사용자명에 할당된 머지 리퀘스트를 반환합니다. assignee_id와 함께 사용할 수 없습니다. |
| author_id | integer | 아니요 | 주어진 사용자 id가 생성한 머지 리퀘스트를 반환합니다. author_username과 함께 사용할 수 없습니다. |
| author_username | string | 아니요 | 주어진 사용자명이 생성한 머지 리퀘스트를 반환합니다. author_id와 함께 사용할 수 없습니다. |
| created_after | datetime | 아니요 | 주어진 날짜 및 시간 이후에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| created_before | datetime | 아니요 | 주어진 날짜 및 시간 이전에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| deployed_after | datetime | 아니요 | 주어진 날짜 및 시간 이후에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| deployed_before | datetime | 아니요 | 주어진 날짜 및 시간 이전에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| environment | string | 아니요 | 주어진 환경에 배포된 머지 리퀘스트를 반환합니다. |
| in | string | 아니요 | 검색 속성의 범위를 변경합니다. title, description, 또는 쉼표로 연결한 문자열을 사용합니다. 기본값은 title,description입니다. |
| labels | string | 아니요 | 쉼표로 구분된 라벨 목록과 일치하는 머지 리퀘스트를 반환합니다. None은 라벨이 없는 모든 머지 리퀘스트를 나열하고, Any는 라벨이 하나 이상 있는 모든 머지 리퀘스트를 나열합니다. 미리 정의된 이름은 대소문자를 구분하지 않습니다. |
| merge_user_id | integer | 아니요 | 주어진 사용자 id를 가진 사용자가 머지한 머지 리퀘스트를 반환합니다. merge_user_username과 함께 사용할 수 없습니다. GitLab 17.0에서 도입됨. |
| merge_user_username | string | 아니요 | 주어진 사용자명을 가진 사용자가 머지한 머지 리퀘스트를 반환합니다. merge_user_id와 함께 사용할 수 없습니다. GitLab 17.0에서 도입됨. |
| milestone | string | 아니요 | 특정 마일스톤에 대한 머지 리퀘스트를 반환합니다. None은 마일스톤이 없는 머지 리퀘스트를 반환하고, Any는 마일스톤이 할당된 머지 리퀘스트를 반환합니다. |
| my_reaction_emoji | string | 아니요 | 인증된 사용자가 주어진 이모지로 반응한 머지 리퀘스트를 반환합니다. None은 반응이 없는 이슈를 반환하고, Any는 반응이 하나 이상 있는 이슈를 반환합니다. |
| not | hash | 아니요 | 제공된 파라미터와 일치하지 않는 머지 리퀘스트를 반환합니다. 허용 값: labels, milestone, author_id, author_username, assignee_id, assignee_username, reviewer_id, reviewer_username, my_reaction_emoji. |
| order_by | string | 아니요 | created_at, updated_at, merged_at(GitLab 17.2에서 도입됨), label_priority, priority, milestone_due, popularity, 또는 title 필드 순으로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 created_at입니다. |
| reviewer_id | integer 또는 string | 아니요 | 주어진 사용자 id를 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환하고, Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_username과 함께 사용할 수 없습니다. |
| reviewer_username | string | 아니요 | 주어진 사용자명을 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환하고, Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_id와 함께 사용할 수 없습니다. |
| scope | string | 아니요 | 주어진 범위(created_by_me, assigned_to_me, reviews_for_me, 또는 all)에 해당하는 머지 리퀘스트를 반환합니다. reviews_for_me는 현재 사용자가 리뷰어로 할당된 머지 리퀘스트를 반환합니다. 기본값은 all입니다. |
| search | string | 아니요 | 제목 및 설명을 기준으로 머지 리퀘스트를 검색합니다. in 속성과 조합하여 사용할 수 있습니다. |
| sort | string | 아니요 | asc 또는 desc 순서로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 desc입니다. |
| source_branch | string | 아니요 | 주어진 소스 브랜치를 가진 머지 리퀘스트를 반환합니다. |
| state | string | 아니요 | 모든 머지 리퀘스트(all) 또는 opened, closed, locked, merged 상태의 머지 리퀘스트만 반환합니다. 기본값은 all입니다. |
| target_branch | string | 아니요 | 주어진 타깃 브랜치를 가진 머지 리퀘스트를 반환합니다. |
| updated_after | datetime | 아니요 | 주어진 날짜 및 시간 이후에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| updated_before | datetime | 아니요 | 주어진 날짜 및 시간 이전에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력해야 합니다. |
| view | string | 아니요 | simple로 지정하면 머지 리퀘스트의 iid, URL, title, description, 기본 상태를 반환합니다. |
| draft | boolean | 아니요 | 드래프트 상태에 따라 머지 리퀘스트를 필터링합니다. true는 드래프트 머지 리퀘스트만 반환하고, false는 드래프트가 아닌 머지 리퀘스트를 반환합니다. wip과 함께 사용할 수 없습니다. |
| wip | string | 아니요 | GitLab 19.0에서 더 이상 사용되지 않습니다. 대신 draft를 사용하세요. wip 상태에 따라 머지 리퀘스트를 필터링합니다. yes는 드래프트 머지 리퀘스트만 반환하고, no는 드래프트가 아닌 머지 리퀘스트를 반환합니다. |
| with_labels_details | boolean | 아니요 | true이면 응답에서 labels 필드의 각 라벨에 대해 :name, :color, :description, :description_html, :text_color 등 더 많은 세부 정보를 반환합니다. 기본값은 false입니다. |
| with_merge_status_recheck | boolean | 아니요 | true이면 이 프로젝션이 merge_status 필드의 비동기 재계산을 요청합니다(보장하지는 않음). restrict_merge_status_recheck 기능 플래그를 활성화하면 Developer, Maintainer, 또는 Owner 권한이 없는 사용자가 요청할 경우 이 속성을 무시합니다. |
성공하면 200 OK와 다음
응답 속성을 반환합니다:
| 속성 | 타입 | 설명 |
|---|---|---|
| [].id | integer | 머지 리퀘스트의 ID. |
| [].iid | integer | 머지 리퀘스트의 내부 ID. |
| [].approvals_before_merge | integer | 이 머지 리퀘스트를 머지하기 전에 필요한 승인 수. 승인 규칙 구성은 Merge request approvals API를 참조하세요. GitLab 16.0에서 더 이상 사용되지 않습니다. Premium 및 Ultimate 전용. |
| [].assignee | object | 머지 리퀘스트의 첫 번째 담당자. |
| [].assignees | array | 머지 리퀘스트의 담당자 목록. |
| [].author | object | 이 머지 리퀘스트를 생성한 사용자. |
| [].blocking_discussions_resolved | boolean | 머지 리퀘스트를 머지하기 전에 모든 토론 해결이 필수인 경우에만 모든 토론이 해결되었는지 여부를 나타냅니다. |
| [].closed_at | datetime | 머지 리퀘스트가 닫힌 타임스탬프. |
| [].closed_by | object | 이 머지 리퀘스트를 닫은 사용자. |
| [].created_at | datetime | 머지 리퀘스트가 생성된 타임스탬프. |
| [].description | string | 머지 리퀘스트의 설명. |
| [].detailed_merge_status | string | 머지 리퀘스트의 상세 머지 상태. 가능한 값 목록은 merge status를 참조하세요. |
| [].discussion_locked | boolean | 머지 리퀘스트의 댓글이 멤버 전용으로 잠겨 있는지 여부를 나타냅니다. |
| [].downvotes | integer | 머지 리퀘스트의 반대 투표 수. |
| [].draft | boolean | 머지 리퀘스트가 드래프트인지 여부를 나타냅니다. |
| [].force_remove_source_branch | boolean | 프로젝트 설정에 따라 머지 후 소스 브랜치를 삭제하는지 여부를 나타냅니다. |
| [].has_conflicts | boolean | 머지 리퀘스트에 충돌이 있어 머지할 수 없는지 여부를 나타냅니다. merge_status 속성에 따라 달라집니다. merge_status가 cannot_be_merged인 경우를 제외하고 false를 반환합니다. |
| [].labels | array | 머지 리퀘스트의 라벨 목록. |
| [].merge_commit_sha | string | 머지 리퀘스트 커밋의 SHA. 머지되기 전까지 null을 반환합니다. |
| [].merge_status | string | 머지 리퀘스트의 상태. unchecked, checking, can_be_merged, cannot_be_merged, 또는 cannot_be_merged_recheck 값을 가질 수 있습니다. has_conflicts 속성에 영향을 미칩니다. 응답 데이터에 대한 중요 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 참조하세요. GitLab 15.6에서 더 이상 사용되지 않습니다. 대신 detailed_merge_status를 사용하세요. |
| [].merge_user | object | 이 머지 리퀘스트를 머지한 사용자, 자동 머지로 설정한 사용자, 또는 null. |
| [].merge_when_pipeline_succeeds | boolean | 머지 리퀘스트가 자동 머지로 설정되어 있는지 여부를 나타냅니다. |
| [].merged_at | datetime | 머지 리퀘스트가 머지된 타임스탬프. |
| [].merged_by | object | 이 머지 리퀘스트를 머지했거나 자동 머지로 설정한 사용자. GitLab 14.7에서 더 이상 사용되지 않으며, API 버전 5에서 제거될 예정입니다. 대신 merge_user를 사용하세요. |
| [].milestone | object | 머지 리퀘스트의 마일스톤. |
| [].prepared_at | datetime | 머지 리퀘스트가 준비된 타임스탬프. 이 필드는 모든 준비 단계가 완료된 후 한 번만 채워지며, 이후 변경 사항이 추가되어도 업데이트되지 않습니다. |
| [].project_id | integer | 머지 리퀘스트가 위치한 프로젝트의 ID. 항상 target_project_id와 동일합니다. |
| [].reference | string | 머지 리퀘스트의 내부 참조. 기본적으로 축약 형식으로 반환됩니다. GitLab 12.7에서 더 이상 사용되지 않으며, API 버전 5에서 제거될 예정입니다. 대신 references를 사용하세요. |
| [].references | object | 머지 리퀘스트의 내부 참조 목록. short, relative, full 참조를 포함합니다. references.relative는 머지 리퀘스트의 그룹 또는 프로젝트를 기준으로 합니다. 머지 리퀘스트의 프로젝트에서 조회할 경우 relative와 short 형식이 동일합니다. 그룹이나 프로젝트를 가로질러 요청하면 relative와 full 형식이 동일합니다. |
| [].reviewers | array | 머지 리퀘스트의 리뷰어 목록. |
| [].sha | string | 머지 리퀘스트의 diff head SHA. |
| [].should_remove_source_branch | boolean | 머지 후 머지 리퀘스트의 소스 브랜치를 삭제해야 하는지 여부를 나타냅니다. |
| [].source_branch | string | 머지 리퀘스트의 소스 브랜치. |
| [].source_project_id | integer | 머지 리퀘스트 소스 프로젝트의 ID. 머지 리퀘스트가 포크에서 시작되지 않은 경우 target_project_id와 동일합니다. |
| [].squash | boolean | true이면 머지 시 모든 커밋을 단일 커밋으로 스쿼시합니다. 프로젝트 설정이 이 값을 재정의할 수 있습니다. 프로젝트 스쿼시 옵션을 반영하려면 squash_on_merge를 사용하세요. |
| [].squash_commit_sha | string | 스쿼시 커밋의 SHA. 머지되기 전까지 비어 있습니다. |
| [].squash_on_merge | boolean | 머지 시 머지 리퀘스트를 스쿼시할지 여부를 나타냅니다. |
| [].state | string | 머지 리퀘스트의 상태. opened, closed, merged, locked 값을 가질 수 있습니다. |
| [].target_branch | string | 머지 리퀘스트의 타깃 브랜치. |
| [].target_project_id | integer | 머지 리퀘스트 타깃 프로젝트의 ID. |
| [].task_completion_status | object | 태스크 완료 상태. count와 completed_count를 포함합니다. |
| [].time_stats | object | 머지 리퀘스트의 시간 추적 통계. time_estimate, total_time_spent, human_time_estimate, human_total_time_spent를 포함합니다. |
| [].title | string | 머지 리퀘스트의 제목. |
| [].updated_at | datetime | 머지 리퀘스트가 업데이트된 타임스탬프. |
| [].upvotes | integer | 머지 리퀘스트의 찬성 투표 수. |
| [].user_notes_count | integer | 머지 리퀘스트의 사용자 노트 수. |
| [].web_url | string | 머지 리퀘스트의 웹 URL. | | [].work_in_progress | boolean | 더 이상 사용되지 않음: 대신 draft를 사용하세요. 머지 리퀘스트가 드래프트 상태인지 나타냅니다. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests"
응답 예시:
[
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"imported": false,
"imported_from": "none",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"locked": false,
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"locked": false,
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"locked": false,
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"locked": false,
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"locked": false,
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"id": 2,
"name": "Sam Bauch",
"username": "kenyatta_oconnell",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/956c92487c6f6f7616b536927e22c9a0?s=80&d=identicon",
"web_url": "http://gitlab.example.com//kenyatta_oconnell"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"reference": "!1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status":{
"count":0,
"completed_count":0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": 2
}
]
응답 데이터에 대한 중요한 참고 사항은 머지 리퀘스트 목록 응답 참고 사항을 확인하세요.
그룹 머지 리퀘스트 목록 조회#
그룹 및 해당 하위 그룹의 모든 머지 리퀘스트를 나열합니다.
GET /groups/:id/merge_requests
GET /groups/:id/merge_requests?state=opened
GET /groups/:id/merge_requests?state=all
GET /groups/:id/merge_requests?milestone=release
GET /groups/:id/merge_requests?labels=bug,reproduced
GET /groups/:id/merge_requests?my_reaction_emoji=star
지원되는 속성:
| 속성 | 타입 | 필수 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 그룹의 ID 또는 URL 인코딩된 경로. |
| approved_by_ids[] | integer array | 아니요 | 지정된 id를 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환합니다. Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approved_by_usernames[] | string array | 아니요 | 지정된 username을 가진 모든 사용자가 승인한 머지 리퀘스트를 반환합니다(최대 5명). None은 승인이 없는 머지 리퀘스트를 반환합니다. Any는 승인이 있는 머지 리퀘스트를 반환합니다. |
| approver_ids[] | integer array | 아니요 | 승인 규칙에 따라 지정된 id를 가진 모든 사용자가 승인 가능한 담당자로 설정된 머지 리퀘스트를 반환합니다. None은 승인 가능한 담당자가 없는 머지 리퀘스트를 반환합니다. Any는 최소 한 명의 승인 가능한 담당자가 있는 머지 리퀘스트를 반환합니다. Premium 및 Ultimate 전용. |
| assignee_id | integer 또는 string | 아니요 | 지정된 사용자 id에 할당된 머지 리퀘스트를 반환합니다. None은 담당자가 없는 머지 리퀘스트를 반환합니다. Any는 담당자가 있는 머지 리퀘스트를 반환합니다. assignee_username과 상호 배타적입니다. |
| assignee_username[] | string array | 아니요 | 지정된 username에 할당된 머지 리퀘스트를 반환합니다. assignee_id와 상호 배타적입니다. |
| author_id | integer | 아니요 | 지정된 사용자 id가 생성한 머지 리퀘스트를 반환합니다. author_username과 상호 배타적입니다. |
| author_username | string | 아니요 | 지정된 username이 생성한 머지 리퀘스트를 반환합니다. author_id와 상호 배타적입니다. |
| created_after | datetime | 아니요 | 지정된 날짜와 시간 이후에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| created_before | datetime | 아니요 | 지정된 날짜와 시간 이전에 생성된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| deployed_after | datetime | 아니요 | 지정된 날짜와 시간 이후에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| deployed_before | datetime | 아니요 | 지정된 날짜와 시간 이전에 배포된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| environment | string | 아니요 | 지정된 환경에 배포된 머지 리퀘스트를 반환합니다. |
| in | string | 아니요 | 검색 속성의 범위를 변경합니다. title, description 또는 이 둘을 쉼표로 연결한 문자열을 사용합니다. 기본값은 title,description입니다. |
| labels | string | 아니요 | 쉼표로 구분된 라벨 목록과 일치하는 머지 리퀘스트를 반환합니다. None은 라벨이 없는 모든 머지 리퀘스트를 나열합니다. Any는 라벨이 하나 이상 있는 모든 머지 리퀘스트를 나열합니다. 사전 정의된 이름은 대소문자를 구분하지 않습니다. |
| merge_user_id | integer | 아니요 | 지정된 사용자 id를 가진 사용자가 머지한 머지 리퀘스트를 반환합니다. merge_user_username과 상호 배타적입니다. GitLab 17.0에서 도입됨. |
| merge_user_username | string | 아니요 | 지정된 username을 가진 사용자가 머지한 머지 리퀘스트를 반환합니다. merge_user_id와 상호 배타적입니다. GitLab 17.0에서 도입됨. |
| milestone | string | 아니요 | 특정 마일스톤에 대한 머지 리퀘스트를 반환합니다. None은 마일스톤이 없는 머지 리퀘스트를 반환합니다. Any는 마일스톤이 할당된 머지 리퀘스트를 반환합니다. |
| my_reaction_emoji | string | 아니요 | 인증된 사용자가 지정된 이모지로 반응한 머지 리퀘스트를 반환합니다. None은 반응이 없는 이슈를 반환합니다. Any는 반응이 하나 이상 있는 이슈를 반환합니다. |
| non_archived | boolean | 아니요 | true이면 아카이브되지 않은 프로젝트의 머지 리퀘스트만 반환합니다. 기본값은 true입니다. |
| not | hash | 아니요 | 지정된 파라미터와 일치하지 않는 머지 리퀘스트를 반환합니다. 허용 값: labels, milestone, author_id, author_username, assignee_id, assignee_username, reviewer_id, reviewer_username, my_reaction_emoji. |
| order_by | string | 아니요 | created_at, updated_at, merged_at(GitLab 17.2에서 도입됨), label_priority, priority, milestone_due, popularity, 또는 title 필드 기준으로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 created_at입니다. |
| reviewer_id | integer 또는 string | 아니요 | 지정된 사용자 id를 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환합니다. Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_username과 상호 배타적입니다. |
| reviewer_username | string | 아니요 | 지정된 username을 가진 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. None은 리뷰어가 없는 머지 리퀘스트를 반환합니다. Any는 리뷰어가 있는 머지 리퀘스트를 반환합니다. reviewer_id와 상호 배타적입니다. |
| scope | string | 아니요 | 지정된 범위(created_by_me, assigned_to_me, reviews_for_me 또는 all)에 대한 머지 리퀘스트를 반환합니다. reviews_for_me는 현재 사용자가 리뷰어로 지정된 머지 리퀘스트를 반환합니다. 기본값은 all입니다. |
| search | string | 아니요 | 제목 및 설명으로 머지 리퀘스트를 검색합니다. in 속성과 함께 사용합니다. |
| sort | string | 아니요 | asc 또는 desc 순서로 정렬된 머지 리퀘스트를 반환합니다. 기본값은 desc입니다. |
| source_branch | string | 아니요 | 지정된 소스 브랜치를 가진 머지 리퀘스트를 반환합니다. |
| source_project_id | integer | 아니요 | 지정된 소스 프로젝트 ID를 가진 머지 리퀘스트를 반환합니다. |
| state | string | 아니요 | 모든 머지 리퀘스트(all) 또는 opened, closed, locked, merged 상태의 머지 리퀘스트를 반환합니다. 기본값은 all입니다. |
| target_branch | string | 아니요 | 지정된 타깃 브랜치를 가진 머지 리퀘스트를 반환합니다. |
| updated_after | datetime | 아니요 | 지정된 날짜와 시간 이후에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| updated_before | datetime | 아니요 | 지정된 날짜와 시간 이전에 업데이트된 머지 리퀘스트를 반환합니다. ISO 8601 형식(2019-03-15T08:00:00Z)으로 입력합니다. |
| view | string | 아니요 | simple로 설정하면 머지 리퀘스트의 iid, URL, 제목, 설명 및 기본 상태를 반환합니다. |
| draft | boolean | 아니요 | 머지 리퀘스트를 초안 상태 여부로 필터링합니다. true는 초안 머지 리퀘스트만 반환하고, false는 초안이 아닌 머지 리퀘스트를 반환합니다. wip과 상호 배타적입니다. |
| wip | string | 아니요 | GitLab 19.0에서 더 이상 사용되지 않음. 대신 draft를 사용하세요. 머지 리퀘스트를 wip 상태로 필터링합니다. yes는 초안 머지 리퀘스트만 반환하고, no는 초안이 아닌 머지 리퀘스트를 반환합니다. |
| with_labels_details | boolean | 아니요 | true이면 응답이 labels 필드의 각 라벨에 대한 추가 세부 정보를 반환합니다: :name, :color, :description, :description_html, :text_color. 기본값은 false입니다. |
| with_merge_status_recheck | boolean | 아니요 | true이면 이 프로젝션이 merge_status 필드의 비동기 재계산을 요청합니다(단, 보장하지는 않습니다). restrict_merge_status_recheck 기능 플래그를 활성화하면 Developer, Maintainer 또는 Owner 권한이 없는 사용자가 요청할 때 이 속성을 무시합니다. |
응답에서 group_id는 머지 리퀘스트가 있는 프로젝트를 포함하는 그룹의 ID를 나타냅니다.
성공하면 200 OK를 반환합니다. view가 simple로 설정된 경우
필드의 일부만 반환합니다. 그 외의 경우 응답 속성은 다음을 포함합니다:
| 속성 | 타입 | 설명 |
|---|---|---|
| allow_collaboration | boolean | true이면 타깃 브랜치에 머지할 수 있는 구성원이 이 포크에서 협업할 수 있습니다. 포크에서의 머지 리퀘스트에만 사용됩니다. |
| allow_maintainer_to_push | boolean | 더 이상 사용되지 않음. 대신 allow_collaboration을 사용하세요. |
| approvals_before_merge | integer | GitLab 16.0에서 더 이상 사용되지 않음. 승인 규칙을 구성하려면 머지 리퀘스트 승인 API를 참조하세요. GitLab Premium 및 Ultimate 전용. |
| assignee[] | object | 더 이상 사용되지 않음. 대신 assignees를 사용하세요. |
| assignees[] | array | 머지 리퀘스트에 할당된 사용자 목록. |
| assignees.avatar_url | string | 담당자의 아바타 이미지 전체 URL. |
| assignees.id | integer | 담당자의 고유 ID. |
| assignees.locked | boolean | true이면 담당자의 계정이 인증 실패로 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| assignees.name | string | 담당자의 표시 이름. 현재 사용자의 권한에 따라 가려질 수 있습니다. |
| assignees.public_email | string | 담당자의 공개 이메일 주소. |
| assignees.state | string | 담당자 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| assignees.username | string | 머지 리퀘스트 담당자의 username. |
| assignees.web_url | string | 담당자의 프로필 페이지 전체 URL. |
| author[] | object | 머지 리퀘스트를 생성한 사용자에 대한 정보가 포함된 객체. |
| author.avatar_url | string | 작성자의 아바타 이미지 전체 URL. |
| author.id | integer | 머지 리퀘스트를 생성한 사용자의 고유 ID. |
| author.locked | boolean | true이면 작성자의 계정이 인증 실패로 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| author.name | string | 작성자의 표시 이름. 현재 사용자의 권한에 따라 가려질 수 있습니다. |
| author.public_email | string | 작성자의 공개 이메일 주소. |
| author.state | string | 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| author.username | string | 머지 리퀘스트 작성자의 username. |
| author.web_url | string | 작성자의 프로필 페이지 전체 URL. |
| blocking_discussions_resolved | boolean | true이면 머지 리퀘스트의 모든 토론 스레드가 머지 전에 해결되어야 합니다. |
| closed_at | dateTime | 머지 리퀘스트가 닫힌 시간의 타임스탬프. |
| closed_by[] | object | 머지 리퀘스트를 닫은 사용자에 대한 정보가 포함된 객체. null이면 머지 리퀘스트가 열려 있습니다. |
| closed_by.avatar_url | string | 닫은 사용자의 아바타 이미지 전체 URL. |
| closed_by.id | integer | 머지 리퀘스트를 닫은 사용자의 고유 ID. |
| closed_by.locked | boolean | true이면 닫은 사용자의 계정이 인증 실패로 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| closed_by.name | string | 닫은 사용자의 표시 이름. 현재 사용자의 권한에 따라 가려질 수 있습니다. |
| closed_by.public_email | string | 닫은 사용자의 공개 이메일 주소. |
| closed_by.state | string | 닫은 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| closed_by.username | string | 머지 리퀘스트를 닫은 사용자의 username. |
| closed_by.web_url | string | 닫은 사용자의 프로필 페이지 전체 URL. |
| created_at | dateTime | 머지 리퀘스트가 생성된 시간의 타임스탬프. |
| description | string | 머지 리퀘스트의 설명. 캐싱을 위해 HTML로 렌더링된 Markdown을 포함합니다. |
| detailed_merge_status | string | 자세한 머지 상태 정보. 가능한 값 목록은 머지 상태를 참조하세요. |
| discussion_locked | boolean | true이면 토론이 잠겨 있습니다. 잠긴 토론에서는 프로젝트 구성원만 댓글을 추가, 편집 또는 해결할 수 있습니다. |
| downvotes | integer | 머지 리퀘스트에 대한 반대 투표 수. |
| draft | boolean | true이면 머지 리퀘스트가 초안 상태로 표시됩니다. |
| force_remove_source_branch | boolean | true이면 프로젝트 설정이 머지 후 소스 브랜치를 강제로 삭제합니다. |
| has_conflicts | boolean | true이면 머지 리퀘스트에 충돌이 있어 머지할 수 없습니다. merge_status 속성에 종속됩니다. merge_status가 cannot_be_merged가 아닌 경우 false를 반환합니다. |
| id | integer | 머지 리퀘스트의 고유 ID. |
| iid | integer | 프로젝트 내 머지 리퀘스트의 내부 ID. |
| imported | boolean | true이면 머지 리퀘스트가 가져온 것입니다. |
| imported_from | string | Bitbucket 등 가져온 원본. |
| labels[] | array | 머지 리퀘스트에 할당된 라벨 배열. with_labels_details가 true이면 각 라벨에 대한 배열을 반환합니다. |
| labels.archived | boolean | with_labels_details가 true이면 라벨의 아카이브 여부. |
| labels.color | string | with_labels_details가 true이면 라벨의 배경 색상. |
| labels.description | string | with_labels_details가 true이면 라벨의 설명 텍스트. null이면 라벨에 설명이 없습니다. |
| labels.description_html | string | with_labels_details가 true이면 라벨의 HTML 렌더링 설명. null이면 라벨에 설명이 없습니다. |
| labels.id | integer | with_labels_details가 true이면 라벨의 고유 ID. |
| labels.name | string | with_labels_details가 true인 경우, 라벨의 이름. | | labels.text_color | string | with_labels_details가 true인 경우, 라벨의 텍스트 색상. | | merge_after | dateTime | 설정된 경우, 머지 리퀘스트를 머지할 수 있는 타임스탬프. GitLab 17.8에서 도입됨. | | merge_commit_sha | string | 설정된 경우, 머지 리퀘스트 커밋의 SHA. 머지 전까지 null을 반환함. | | merge_status | string | 머지 리퀘스트의 상태. 모든 잠재적 상태를 고려하는 detailed_merge_status를 대신 사용하세요. has_conflicts 속성에 영향을 줍니다. 응답 데이터에 관한 중요한 참고 사항은 단일 머지 리퀘스트 응답 참고를 확인하세요. GitLab 15.6에서 더 이상 사용되지 않음. | | merge_user | object | 머지 리퀘스트를 머지하거나, 자동 머지로 설정한 사용자에 대한 정보가 담긴 오브젝트, 또는 null. | | merge_when_pipeline_succeeds | boolean | true인 경우, 머지 리퀘스트가 자동 머지로 설정됨. | | merged_at | dateTime | 머지 리퀘스트가 머지된 타임스탬프. | | merged_by[] | object | 더 이상 사용되지 않음. 대신 merge_user를 사용하세요. | | milestone[] | object | 머지 리퀘스트에 할당된 마일스톤 정보가 담긴 오브젝트. | | milestone.created_at | dateTime | 마일스톤이 생성된 타임스탬프. | | milestone.description | string | 마일스톤의 설명 텍스트. null인 경우, 마일스톤에 설명이 없음. | | milestone.due_date | date | 마일스톤의 마감일. null인 경우, 마일스톤에 마감일이 없음. | | milestone.expired | boolean | true인 경우, 마일스톤이 만료됨. | | milestone.group_id | integer | 마일스톤이 속한 그룹의 ID. 그룹 마일스톤인 경우에만 포함됨. | | milestone.id | integer | 마일스톤의 고유 ID. | | milestone.iid | integer | 프로젝트 또는 그룹 내 마일스톤의 내부 ID. | | milestone.project_id | integer | 마일스톤이 속한 프로젝트의 ID. 프로젝트 마일스톤인 경우에만 포함됨. | | milestone.start_date | date | 마일스톤의 시작일. null인 경우, 마일스톤에 시작일이 없음. | | milestone.state | string | 마일스톤의 현재 상태(예: active 또는 closed). | | milestone.title | string | 마일스톤의 이름. | | milestone.updated_at | dateTime | 마일스톤이 마지막으로 업데이트된 타임스탬프. | | milestone.web_url | string | 마일스톤을 볼 수 있는 전체 웹 URL. | | prepared_at | dateTime | 머지 리퀘스트가 준비된 타임스탬프. 이 필드는 모든 준비 단계가 완료된 후 한 번만 채워지며, 변경 사항이 추가되어도 업데이트되지 않음. | | project_id | integer | 머지 리퀘스트가 포함된 프로젝트의 ID. | | reference | string | 더 이상 사용되지 않음. 대신 references를 사용하세요. | | references[] | object | 머지 리퀘스트의 모든 내부 참조가 담긴 오브젝트. | | references.full | string | gitlab-org/gitlab!123과 같이 전체 프로젝트 경로를 포함한 머지 리퀘스트에 대한 완전한 참조. 그룹 또는 프로젝트를 가로질러 요청하면 references.relative와 동일함. | | references.relative | string | 특정 프로젝트 또는 그룹에 상대적인 참조: 현재 프로젝트의 머지 리퀘스트는 !123, 같은 그룹 내 다른 프로젝트는 other-project!123. | | references.short | string | !123과 같이 머지 리퀘스트에 대한 가장 짧은 참조. 머지 리퀘스트의 프로젝트에서 가져온 경우 references.relative와 동일함. | | reviewers[] | array | 머지 리퀘스트의 리뷰어 목록. | | reviewers.avatar_url | string | 리뷰어의 아바타 이미지에 대한 전체 URL. | | reviewers.id | integer | 리뷰어의 고유 ID. | | reviewers.locked | boolean | true인 경우, 리뷰어의 계정이 인증 실패로 잠겨 있어, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없음. | | reviewers.name | string | 리뷰어의 표시 이름. 현재 사용자의 권한에 따라 가려질 수 있음. | | reviewers.public_email | string | 리뷰어의 공개 이메일 주소. | | reviewers.state | string | 리뷰어 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. | | reviewers.username | string | 머지 리퀘스트 리뷰어의 사용자 이름. | | reviewers.web_url | string | 리뷰어의 프로필 페이지에 대한 전체 URL. | | sha | string | 소스 브랜치의 헤드 커밋 SHA. | | should_remove_source_branch | boolean | true인 경우, 머지 후 소스 브랜치가 삭제됨. | | source_branch | string | 소스 브랜치의 이름. | | source_project_id | integer | 소스 프로젝트의 ID. | | squash | boolean | true인 경우, 머지 시 커밋을 스쿼시함. | | squash_commit_sha | string | 설정된 경우, 스쿼시 커밋의 SHA. 머지 전까지 비어 있음. | | squash_on_merge | boolean | true인 경우, 머지 시 커밋이 스쿼시됨. | | state | string | 머지 리퀘스트의 현재 상태. 가능한 값: opened, closed, merged, 또는 locked. | | target_branch | string | 타깃 브랜치의 이름. | | target_project_id | integer | 타깃 프로젝트의 ID. | | task_completion_status[] | object | 태스크 목록 완료 상태에 대한 정보가 담긴 오브젝트. | | task_completion_status.completed_count | integer | 머지 리퀘스트 설명에서 완료된 태스크 목록 항목의 수. 머지 리퀘스트에 설명이 없거나 태스크 목록 항목이 없으면 0을 반환함. | | task_completion_status.count | integer | 머지 리퀘스트 설명에서 발견된 태스크 목록 항목의 총 수. 머지 리퀘스트에 설명이 없거나 태스크 목록 항목이 없으면 0을 반환함. | | time_stats[] | object | 이 머지 리퀘스트의 시간 추적 정보가 담긴 오브젝트. | | time_stats.human_time_estimate | string | time_stats.time_estimate의 사람이 읽기 쉬운 형식(예: 3h 30m). | | time_stats.human_total_time_spent | string | time_stats.total_time_spent의 사람이 읽기 쉬운 형식(예: 3h 30m). | | time_stats.time_estimate | integer | 머지 리퀘스트 완료 예상 시간(초 단위). | | time_stats.total_time_spent | integer | 머지 리퀘스트 작업에 소요된 총 시간(초 단위). | | title | string | 머지 리퀘스트 제목. | | updated_at | dateTime | 머지 리퀘스트가 마지막으로 업데이트된 타임스탬프. | | upvotes | integer | 머지 리퀘스트의 추천 수. | | user_notes_count | integer | 사용자 댓글 수. | | web_url | string | 머지 리퀘스트를 볼 수 있는 웹 URL. | | work_in_progress | boolean | 더 이상 사용되지 않음. 대신 draft를 사용하세요. |
기타 가능한 응답:
-
401 Unauthorized: 액세스 토큰이 유효하지 않은 경우. -
404 Not Found: 프로젝트 또는 머지 리퀘스트를 찾을 수 없는 경우. -
422 Unprocessable Entity: 유효성 검사가 실패한 경우. -
429 Too Many Requests:search파라미터를 사용하고 요청이 속도 제한에 걸린 경우.
응답 예시:
[
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"imported": false,
"imported_from": "none",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"id": 2,
"name": "Sam Bauch",
"username": "kenyatta_oconnell",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/956c92487c6f6f7616b536927e22c9a0?s=80&d=identicon",
"web_url": "http://gitlab.example.com//kenyatta_oconnell"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-10-22",
"start_date": "2018-09-08",
"web_url": "gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "my-project!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status":{
"count":0,
"completed_count":0
},
"has_conflicts": false,
"blocking_discussions_resolved": true
}
]
응답 데이터에 대한 중요 참고 사항은 머지 리퀘스트 목록 응답 참고 사항을 참조하세요.
머지 리퀘스트 조회#
머지 리퀘스트에 대한 정보를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid
지원되는 속성:
| 속성 | 유형 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | 예 | 머지 리퀘스트의 내부 ID. |
| include_diverged_commits_count | boolean | 아니요 | true이면 타깃 브랜치보다 뒤처진 커밋이 응답에 포함됩니다. |
| include_rebase_in_progress | boolean | 아니요 | true이면 리베이스 작업이 진행 중인지 여부가 응답에 포함됩니다. |
| render_html | boolean | 아니요 | true이면 제목과 설명에 대한 렌더링된 HTML이 응답에 포함됩니다. |
성공하면 200 OK를 반환합니다. 기타 가능한 응답:
-
401 Unauthorized— 액세스 토큰이 유효하지 않은 경우. -
403 Forbidden— 액세스가 거부된 경우. -
404 Not Found— 프로젝트 또는 머지 리퀘스트를 찾을 수 없는 경우. -
408 Request Timeout— 데이터베이스 쿼리가 시간 초과된 경우. -
409 Conflict— 리소스 잠금 충돌이 존재하는 경우. -
422 Unprocessable Entity— 유효성 검사에 실패한 경우. -
429 Too Many Requests—search파라미터를 사용 중이며 요청이 속도 제한된 경우.
응답#
| 속성 | 유형 | 설명 |
|---|---|---|
| allow_collaboration | boolean | true이면 타깃 브랜치에 머지할 수 있는 멤버의 협업이 이 포크에서 허용됩니다. 포크에서 생성된 머지 리퀘스트에만 사용됩니다. |
| allow_maintainer_to_push | boolean | 더 이상 사용되지 않습니다. 대신 allow_collaboration을 사용하세요. |
| approvals_before_merge | integer | GitLab 16.0에서 더 이상 사용되지 않습니다. 승인 규칙을 구성하려면 대신 머지 리퀘스트 승인 API를 참조하세요. GitLab Premium 및 Ultimate 전용. |
| assignee[] | object | 더 이상 사용되지 않습니다. 대신 assignees를 사용하세요. |
| assignees[] | array | 머지 리퀘스트에 지정된 사용자. |
| assignees.avatar_url | string | 담당자의 아바타 이미지에 대한 전체 URL. |
| assignees.id | integer | 담당자의 고유 ID. |
| assignees.locked | boolean | true이면 담당자의 계정이 인증 시도 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| assignees.name | string | 담당자의 표시 이름. 현재 사용자의 권한에 따라 redacted될 수 있습니다. |
| assignees.public_email | string | 담당자의 공개 이메일 주소. |
| assignees.state | string | 담당자 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| assignees.username | string | 머지 리퀘스트 담당자의 사용자 이름. |
| assignees.web_url | string | 담당자의 프로필 페이지에 대한 전체 URL. |
| author[] | object | 머지 리퀘스트를 생성한 사용자에 대한 정보가 담긴 객체. |
| author.avatar_url | string | 작성자의 아바타 이미지에 대한 전체 URL. |
| author.id | integer | 머지 리퀘스트를 생성한 사용자의 고유 ID. |
| author.locked | boolean | true이면 작성자의 계정이 인증 시도 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| author.name | string | 작성자의 표시 이름. 현재 사용자의 권한에 따라 redacted될 수 있습니다. |
| author.public_email | string | 작성자의 공개 이메일 주소. |
| author.state | string | 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| author.username | string | 머지 리퀘스트 작성자의 사용자 이름. |
| author.web_url | string | 작성자의 프로필 페이지에 대한 전체 URL. |
| blocking_discussions_resolved | boolean | true이면 머지 전에 머지 리퀘스트의 모든 토론 스레드가 해결되어야 합니다. |
| changes_count | string | 설정된 경우 머지 리퀘스트에서 변경된 수를 나타냅니다. 머지 리퀘스트가 생성될 때는 비어 있으며, 비동기적으로 채워집니다. 정수가 아닌 문자열입니다. 머지 리퀘스트의 변경 사항이 너무 많아 표시하거나 저장할 수 없는 경우, 값은 1000으로 제한되며 "1000+"라는 문자열을 반환합니다. 새 머지 리퀘스트의 빈 API 필드를 참조하세요. |
| closed_at | dateTime | 머지 리퀘스트가 닫힌 시간의 타임스탬프. |
| closed_by[] | object | 머지 리퀘스트를 닫은 사용자에 대한 정보가 담긴 객체. null이면 머지 리퀘스트가 열려 있는 상태입니다. |
| closed_by.avatar_url | string | 닫은 사용자의 아바타 이미지에 대한 전체 URL. |
| closed_by.id | integer | 머지 리퀘스트를 닫은 사용자의 고유 ID. |
| closed_by.locked | boolean | true이면 닫은 사용자의 계정이 인증 시도 실패로 인해 잠겨 있으며, 잠금이 만료되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없습니다. |
| closed_by.name | string | 닫은 사용자의 표시 이름. 현재 사용자의 권한에 따라 redacted될 수 있습니다. |
| closed_by.public_email | string | 닫은 사용자의 공개 이메일 주소. |
| closed_by.state | string | 닫은 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. |
| closed_by.username | string | 머지 리퀘스트를 닫은 사용자의 사용자 이름. |
| closed_by.web_url | string | 닫은 사용자의 프로필 페이지에 대한 전체 URL. |
| created_at | datetime | 머지 리퀘스트가 생성된 시간의 타임스탬프. |
| description | string | 머지 리퀘스트의 설명. 캐싱을 위해 HTML로 렌더링된 Markdown이 포함됩니다. |
| detailed_merge_status | string | 상세 머지 상태 정보. 잠재적인 값 목록은 머지 상태를 참조하세요. |
| diff_refs[] | object | 이 머지 리퀘스트의 base, head, start SHA에 대한 참조가 담긴 객체. 머지 리퀘스트의 최신 diff 버전에 해당합니다. 머지 리퀘스트가 생성될 때는 비어 있으며, 비동기적으로 채워집니다. 새 머지 리퀘스트의 빈 API 필드를 참조하세요. |
| diff_refs.base_sha | string | 소스 브랜치와 타깃 브랜치가 분기된 머지 베이스 커밋의 SHA. |
| diff_refs.start_sha | string | 타깃 브랜치 커밋의 SHA. diff의 시작점. 일반적으로 base_sha와 동일합니다. |
| diff_refs.head_sha | string | 소스 브랜치의 헤드 커밋 SHA. 머지 리퀘스트의 최신 커밋. |
| discussion_locked | boolean | true이면 토론이 잠겨 있습니다. 잠긴 토론에서는 프로젝트 멤버만 댓글을 추가, 편집, 해결할 수 있습니다. |
| diverged_commits_count | integer | 설정된 경우 소스 브랜치가 타깃 브랜치보다 뒤처진 커밋 수를 포함합니다. |
| downvotes | integer | 머지 리퀘스트에 대한 다운보트 수. |
| draft | boolean | true이면 머지 리퀘스트가 초안 상태로 표시됩니다. |
| first_contribution | boolean | true이면 이 프로젝트에 대한 작성자의 첫 기여입니다. |
| first_deployed_to_production_at | datetime | 첫 번째 배포가 완료된 시간의 타임스탬프. |
| force_remove_source_branch | boolean | true이면 프로젝트 설정에 따라 머지 후 소스 브랜치가 강제로 삭제됩니다. |
| has_conflicts | boolean | true이면 머지 리퀘스트에 충돌이 있어 머지할 수 없습니다. merge_status 속성에 의존합니다. merge_status가 cannot_be_merged인 경우에만 false가 아닌 값을 반환합니다. |
| head_pipeline[] | object | 머지 리퀘스트 소스 브랜치의 HEAD 커밋에서 실행되는 파이프라인. pipeline 대신 사용하세요. 더 완전한 정보를 포함합니다. 현재 사용자가 이 프로젝트의 파이프라인을 볼 수 있는 경우에만 노출됩니다. |
| head_pipeline.before_sha | string | 이 파이프라인 이전 커밋의 SHA. |
| head_pipeline.committed_at | dateTime | 커밋이 이루어진 시간의 타임스탬프. |
| head_pipeline.coverage | number | 테스트 커버리지 비율 (예: 98.29). |
| head_pipeline.created_at | dateTime | 파이프라인이 생성된 시간의 타임스탬프. |
| head_pipeline.detailed_status[] | object | 이 파이프라인의 상세 상태에 대한 필드를 포함하는 객체. |
| head_pipeline.detailed_status.action[] | object | 설정된 경우 이 파이프라인에 대해 사용 가능한 액션을 포함하는 객체. |
| head_pipeline.detailed_status.action.button_title | string | 액션의 버튼 제목. |
| head_pipeline.detailed_status.action.confirmation_message | string | 액션의 확인 메시지. |
| head_pipeline.detailed_status.action.icon | string | 액션의 아이콘. |
| head_pipeline.detailed_status.action.method | string | 액션의 HTTP 메서드 (예: POST). |
| head_pipeline.detailed_status.action.path | string | 액션의 경로 (예: "/namespace1/project1/-/jobs/2/cancel"). |
| head_pipeline.detailed_status.action.title | string | 액션의 제목. |
| head_pipeline.detailed_status.details_path | string | 상세 보기 경로 (예: "/test-group/test-project/-/pipelines/287"). |
| head_pipeline.detailed_status.favicon | string | 상태 파비콘의 경로. |
| head_pipeline.detailed_status.group | string | 상태 그룹 (예: success). |
| head_pipeline.detailed_status.has_details | boolean | 설정된 경우 상세 보기를 사용할 수 있습니다. |
| head_pipeline.detailed_status.icon | string | 상태 아이콘 이름 (예: "status_success"). |
| head_pipeline.detailed_status.illustration.content | string | 일러스트레이션의 콘텐츠 텍스트 (예: "This job depends on upstream jobs that need to succeed in order for this job to be triggered"). |
| head_pipeline.detailed_status.illustration.image | string | 일러스트레이션 이미지의 경로. |
| head_pipeline.detailed_status.illustration.size | string | 일러스트레이션의 크기. |
| head_pipeline.detailed_status.illustration.title | string | 일러스트레이션의 제목 (예: "This job has not been triggered yet"). |
| head_pipeline.detailed_status.label | string | 파이프라인의 상태 라벨 (예: "passed"). |
| head_pipeline.detailed_status.text | string | 파이프라인의 상태 텍스트 (예: "passed"). |
| head_pipeline.detailed_status.tooltip | string | 파이프라인의 툴팁 텍스트 (예: "passed"). |
| head_pipeline.duration | integer | 파이프라인 실행에 소요된 시간 (초 단위). |
| head_pipeline.finished_at | dateTime | 파이프라인이 완료된 시간의 타임스탬프. |
| head_pipeline.id | integer | 파이프라인의 고유 숫자 식별자. ci_pipelines 테이블의 외래 키. | | head_pipeline.iid | integer | 파이프라인의 내부 숫자 ID. | | head_pipeline.project_id | integer | 파이프라인을 포함하는 프로젝트의 숫자 ID. | | head_pipeline.queued_duration | integer | 대기열에서 대기한 시간(초 단위). | | head_pipeline.ref | string | 파이프라인이 실행되는 Git 참조(브랜치 또는 태그)의 이름. | | head_pipeline.sha | string | 파이프라인을 트리거한 커밋의 SHA. | | head_pipeline.source | string | 파이프라인이 트리거된 방법. 예: push, merge_request_event, 또는 api | | head_pipeline.started_at | dateTime | 파이프라인이 실행을 시작한 타임스탬프. | | head_pipeline.status | string | 파이프라인의 현재 상태. 가능한 값: success, failed, running, pending | | head_pipeline.tag | boolean | true이면 이 파이프라인은 Git 태그에서 실행 중. | | head_pipeline.updated_at | dateTime | 파이프라인이 마지막으로 업데이트된 타임스탬프. | | head_pipeline.user[] | object | 파이프라인을 트리거한 사용자에 대한 정보를 포함하는 객체. | | head_pipeline.user.avatar_url | string | 사용자 아바타 이미지의 전체 URL. | | head_pipeline.user.id | integer | 파이프라인을 트리거한 사용자의 고유 ID. | | head_pipeline.user.locked | boolean | true이면 파이프라인을 트리거한 사용자 계정이 인증 실패로 잠겨 있으며, 잠금이 해제되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없음. | | head_pipeline.user.name | string | 파이프라인을 트리거한 사용자의 표시 이름. 현재 사용자의 권한에 따라 편집될 수 있음. | | head_pipeline.user.public_email | string | 파이프라인을 트리거한 사용자의 공개 이메일 주소. | | head_pipeline.user.state | string | 파이프라인을 트리거한 사용자 계정의 현재 상태. 가능한 값: active, blocked, 또는 deactivated. | | head_pipeline.user.username | string | 파이프라인을 트리거한 사용자의 사용자명. | | head_pipeline.user.web_url | string | 파이프라인을 트리거한 사용자의 프로필 페이지 전체 URL. | | head_pipeline.web_url | string | 파이프라인 페이지의 전체 URL. | | head_pipeline.yaml_errors | string | YAML 구성 오류. 예: widgets:build: needs 'widgets:test') | | id | integer | 머지 리퀘스트의 ID. | | iid | integer | 머지 리퀘스트의 내부 ID. | | imported | boolean | true이면 머지 리퀘스트를 가져온 것. | | imported_from | string | Bitbucket 등 가져온 소스. | | labels[] | array | 머지 리퀘스트에 할당된 라벨 배열. with_labels_details가 true이면 각 라벨에 대한 배열을 반환. | | labels.archived | boolean | with_labels_details가 true이면 라벨이 보관됨. | | labels.color | string | with_labels_details가 true이면 라벨의 배경 색상. | | labels.description | string | with_labels_details가 true이면 라벨의 설명 텍스트. null이면 라벨에 설명이 없음. | | labels.description_html | string | with_labels_details가 true이면 라벨의 HTML 렌더링 설명. null이면 라벨에 설명이 없음. | | labels.id | integer | with_labels_details가 true이면 라벨의 고유 ID. | | labels.name | string | with_labels_details가 true이면 라벨의 이름. | | labels.text_color | string | with_labels_details가 true이면 라벨의 텍스트 색상. | | latest_build_finished_at | datetime | 머지 리퀘스트의 최신 빌드가 완료된 타임스탬프. | | latest_build_started_at | datetime | 머지 리퀘스트의 최신 빌드가 시작된 타임스탬프. | | merge_after | dateTime | 설정된 경우 머지 리퀘스트가 병합 가능한 이후의 타임스탬프. GitLab 17.8에서 도입됨. | | merge_commit_sha | string | 설정된 경우 머지 리퀘스트 커밋의 SHA. 병합될 때까지 null 반환. | | merge_error | string | 설정된 경우 병합 실패 시 표시되는 오류 메시지. 병합 가능 여부를 확인하려면 detailed_merge_status를 대신 사용. | | merge_status | string | 머지 리퀘스트의 상태. 모든 가능한 상태를 고려하는 detailed_merge_status를 대신 사용. has_conflicts 속성에 영향을 줌. 응답 데이터에 대한 중요 사항은 단일 머지 리퀘스트 응답 노트를 참조. GitLab 15.6에서 더 이상 사용되지 않음. | | merge_user[] | object | 이 머지 리퀘스트를 병합한 사용자, 자동 병합으로 설정한 사용자, 또는 null. | | merge_when_pipeline_succeeds | boolean | true이면 머지 리퀘스트가 자동 병합으로 설정됨. | | merged_at | dateTime | 머지 리퀘스트가 병합된 타임스탬프. | | merged_by[] | object | 이 머지 리퀘스트를 병합하거나 자동 병합으로 설정한 사용자. GitLab 14.7에서 더 이상 사용되지 않으며, API 버전 5에서 제거 예정. 대신 merge_user를 사용. | | milestone[] | object | 머지 리퀘스트에 할당된 마일스톤에 대한 정보를 포함하는 객체. | | milestone.created_at | dateTime | 마일스톤이 생성된 타임스탬프. | | milestone.description | string | 마일스톤의 설명 텍스트. null이면 마일스톤에 설명이 없음. | | milestone.due_date | date | 마일스톤의 마감일. null이면 마일스톤에 마감일이 없음. | | milestone.expired | boolean | true이면 마일스톤이 만료됨. | | milestone.group_id | integer | 마일스톤이 속한 그룹의 ID. 그룹 마일스톤인 경우에만 포함됨. | | milestone.id | integer | 마일스톤의 고유 ID. | | milestone.iid | integer | 프로젝트 또는 그룹 내 마일스톤의 내부 ID. | | milestone.project_id | integer | 마일스톤이 속한 프로젝트의 ID. 프로젝트 마일스톤인 경우에만 포함됨. | | milestone.start_date | date | 마일스톤의 시작일. null이면 마일스톤에 시작일이 없음 | | milestone.state | string | active 또는 closed 등 마일스톤의 현재 상태. | | milestone.title | string | 마일스톤의 이름. | | milestone.updated_at | dateTime | 마일스톤이 마지막으로 업데이트된 타임스탬프. | | milestone.web_url | string | 마일스톤을 보기 위한 전체 웹 URL. | | pipeline[] | object | 머지 리퀘스트의 브랜치 HEAD에서 실행 중인 파이프라인. 더 많은 정보를 포함하는 head_pipeline을 대신 사용하는 것을 권장. | | prepared_at | dateTime | 머지 리퀘스트가 준비된 타임스탬프. 이 필드는 모든 준비 단계가 완료된 후 한 번만 채워지며, 더 많은 변경이 추가되어도 업데이트되지 않음. | | project_id | integer | 머지 리퀘스트를 포함하는 프로젝트의 ID. | | rebase_in_progress | boolean | true이면 Sidekiq이 이 브랜치에서 리베이스 작업을 실행 중. | | reference | string | 더 이상 사용되지 않음. references를 대신 사용. GitLab 12.7에서 더 이상 사용되지 않으며, API 버전 5에서 제거 예정. references를 대신 사용. | | references[] | object | 머지 리퀘스트의 모든 내부 참조를 포함하는 객체. | | references.full | string | gitlab-org/gitlab!123처럼 전체 프로젝트 경로를 포함한 머지 리퀘스트의 완전한 참조. 그룹 또는 프로젝트 간에 요청할 때 references.relative와 동일. | | references.relative | string | 특정 프로젝트 또는 그룹에 상대적인 참조: 현재 프로젝트의 머지 리퀘스트의 경우 !123, 같은 그룹의 다른 프로젝트의 경우 other-project!123. | | references.short | string | !123처럼 가능한 가장 짧은 머지 리퀘스트 참조. 머지 리퀘스트의 프로젝트에서 가져올 때 references.relative와 동일. | | reviewers[] | array | 머지 리퀘스트의 검토자 목록. | | reviewers.avatar_url | string | 검토자의 아바타 이미지 전체 URL. | | reviewers.id | integer | 검토자의 고유 ID. | | reviewers.locked | boolean | true이면 검토자의 계정이 인증 실패로 잠겨 있으며, 잠금이 해제되거나 관리자가 잠금을 해제할 때까지 로그인할 수 없음. | | reviewers.name | string | 검토자의 표시 이름. 현재 사용자의 권한에 따라 편집될 수 있음. | | reviewers.public_email | string | 검토자의 공개 이메일 주소. | | reviewers.state | string | 검토자의 사용자 계정 현재 상태. 가능한 값: active, blocked, 또는 deactivated. | | reviewers.username | string | 머지 리퀘스트 검토자의 사용자명. | | reviewers.web_url | string | 검토자의 프로필 페이지 전체 URL. | | sha | string | 소스 브랜치의 헤드 커밋 SHA. | | should_remove_source_branch | boolean | true이면 병합 후 소스 브랜치가 제거됨. | | source_branch | string | 소스 브랜치의 이름. | | source_project_id | integer | 소스 프로젝트의 ID. | | squash | boolean | true이면 병합 시 커밋을 스쿼시. | | squash_commit_sha | string | 설정된 경우 스쿼시 커밋의 SHA. 병합될 때까지 비어 있음. | | squash_on_merge | boolean | true이면 병합 시 커밋이 스쿼시됨. | | state | string | 머지 리퀘스트의 현재 상태. 가능한 값: opened, closed, merged, 또는 locked. | | subscribed | boolean | true이면 현재 인증된 사용자가 이 머지 리퀘스트를 구독함. | | target_branch | string | 타깃 브랜치의 이름. | | target_project_id | integer | 타깃 프로젝트의 ID. | | task_completion_status[] | object | 작업 목록 완료 상태에 대한 정보를 포함하는 객체. | | task_completion_status.completed_count | integer | 머지 리퀘스트 설명에서 완료된 작업 목록 항목의 수. 머지 리퀘스트에 설명이 없거나 작업 목록 항목이 없으면 0 반환. | | task_completion_status.count | integer | 머지 리퀘스트 설명에서 발견된 작업 목록 항목의 총 수. 머지 리퀘스트에 설명이 없거나 작업 목록 항목이 없으면 0 반환. | | time_stats[] | object | 이 머지 리퀘스트의 시간 추적에 대한 정보를 포함하는 객체. | | time_stats.human_time_estimate | string | 3h 30m처럼 사람이 읽을 수 있는 형식의 time_stats.time_estimate. | | time_stats.human_total_time_spent | string | 3h 30m처럼 사람이 읽을 수 있는 형식의 time_stats.total_time_spent. | | time_stats.time_estimate | integer | 머지 리퀘스트를 완료하기 위한 예상 시간(초 단위). | | time_stats.total_time_spent | integer | 머지 리퀘스트 작업에 소요된 총 시간(초 단위). | | title | string | 머지 리퀘스트 제목. | | updated_at | datetime | 머지 리퀘스트가 마지막으로 업데이트된 타임스탬프. | | upvotes | integer | 머지 리퀘스트의 추천 수. | | user[] | object | 머지 리퀘스트에 대해 요청된 사용자의 권한. | | user.can_merge | boolean | true이면 현재 인증된 사용자가 이 머지 리퀘스트를 병합할 수 있음. | | user_notes_count | integer | 사용자 댓글 수. | | web_url | string | 머지 리퀘스트를 보기 위한 웹 URL. | | work_in_progress | boolean | 더 이상 사용되지 않음. draft를 대신 사용. |
응답 예시:
{
"id": 155016530,
"iid": 133,
"project_id": 15513260,
"title": "Manual job rules",
"description": "",
"state": "opened",
"imported": false,
"imported_from": "none",
"created_at": "2022-05-13T07:26:38.402Z",
"updated_at": "2022-05-14T03:38:31.354Z",
"merged_by": null, // Deprecated and will be removed in API v5. Use `merge_user` instead.
"merge_user": null,
"merged_at": null,
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"target_branch": "main",
"source_branch": "manual-job-rules",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 4155490,
"username": "marcel.amirault",
"name": "Marcel Amirault",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/4155490/avatar.png",
"web_url": "https://gitlab.com/marcel.amirault"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 15513260,
"target_project_id": 15513260,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"detailed_merge_status": "mergeable",
"sha": "e82eb4a098e32c796079ca3915e07487fc4db24c",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"reference": "!133", // Deprecated. Use `references` instead.
"references": {
"short": "!133",
"relative": "!133",
"full": "marcel.amirault/test-project!133"
},
"web_url": "https://gitlab.com/marcel.amirault/test-project/-/merge_requests/133",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null, // deprecated, use [Merge request approvals API](merge_request_approvals.md)
"subscribed": true,
"changes_count": "1",
"latest_build_started_at": "2022-05-13T09:46:50.032Z",
"latest_build_finished_at": null,
"first_deployed_to_production_at": null,
"pipeline": { // Use `head_pipeline` instead.
"id": 538317940,
"iid": 1877,
"project_id": 15513260,
"sha": "1604b0c46c395822e4e9478777f8e54ac99fe5b9",
"ref": "refs/merge-requests/133/merge",
"status": "failed",
"source": "merge_request_event",
"created_at": "2022-05-13T09:46:39.560Z",
"updated_at": "2022-05-13T09:47:20.706Z",
"web_url": "https://gitlab.com/marcel.amirault/test-project/-/pipelines/538317940"
},
"head_pipeline": {
"id": 538317940,
"iid": 1877,
"project_id": 15513260,
"sha": "1604b0c46c395822e4e9478777f8e54ac99fe5b9",
"ref": "refs/merge-requests/133/merge",
"status": "failed",
"source": "merge_request_event",
"created_at": "2022-05-13T09:46:39.560Z",
"updated_at": "2022-05-13T09:47:20.706Z",
"web_url": "https://gitlab.com/marcel.amirault/test-project/-/pipelines/538317940",
"before_sha": "1604b0c46c395822e4e9478777f8e54ac99fe5b9",
"tag": false,
"yaml_errors": null,
"user": {
"id": 4155490,
"username": "marcel.amirault",
"name": "Marcel Amirault",
"state": "active",
"avatar_url": "https://gitlab.com/uploads/-/system/user/avatar/4155490/avatar.png",
"web_url": "https://gitlab.com/marcel.amirault"
},
"started_at": "2022-05-13T09:46:50.032Z",
"finished_at": "2022-05-13T09:47:20.697Z",
"committed_at": null,
"duration": 30,
"queued_duration": 10,
"coverage": null,
"detailed_status": {
"icon": "status_failed",
"text": "failed",
"label": "failed",
"group": "failed",
"tooltip": "failed",
"has_details": true,
"details_path": "/marcel.amirault/test-project/-/pipelines/538317940",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_failed-41304d7f7e3828808b0c26771f0309e55296819a9beea3ea9fbf6689d9857c12.png"
},
"archived": false
},
"diff_refs": {
"base_sha": "1162f719d711319a2efb2a35566f3bfdadee8bab",
"head_sha": "e82eb4a098e32c796079ca3915e07487fc4db24c",
"start_sha": "1162f719d711319a2efb2a35566f3bfdadee8bab"
},
"merge_error": null,
"first_contribution": false,
"user": {
"can_merge": true
},
"approvals_before_merge": { // Available for GitLab Premium and Ultimate tiers only
"id": 1,
"title": "test1",
"approvals_before_merge": null
},
}
단일 머지 리퀘스트 응답 노트#
각 머지 리퀘스트의 병합 가능 여부(merge_status)는
이 엔드포인트에 요청이 들어올 때 비동기적으로 확인됩니다. 업데이트된 상태를 얻으려면 이 API 엔드포인트를 폴링하세요. 이는 has_conflicts 속성에 영향을 미치며, 이 속성은 merge_status에 의존합니다. merge_status가 cannot_be_merged인 경우를 제외하고는
false를 반환합니다.
머지 상태#
가능한 모든 상태를 처리하려면 merge_status 대신 detailed_merge_status를 사용하세요.
detailed_merge_status필드는 머지 리퀘스트와 관련된 다음 값 중 하나를 포함할 수 있습니다:
approvals_syncing: 머지 리퀘스트의 승인이 동기화 중입니다.
-
checking: Git이 유효한 병합이 가능한지 테스트하고 있습니다. -
ci_must_pass: 병합 전에 CI/CD 파이프라인이 성공해야 합니다. -
ci_still_running: CI/CD 파이프라인이 아직 실행 중입니다. -
commits_status: 소스 브랜치가 존재하고 커밋을 포함해야 합니다. -
conflict: 소스 브랜치와 타깃 브랜치 사이에 충돌이 존재합니다. -
discussions_not_resolved: 병합 전에 모든 토론이 해결되어야 합니다. -
draft_status: 머지 리퀘스트가 드래프트 상태이므로 병합할 수 없습니다. -
jira_association_missing: 제목 또는 설명이 Jira 이슈를 참조해야 합니다. 설정 방법은 머지 리퀘스트 병합을 위한 Jira 이슈 연결 필수 설정을 참조하세요. -
mergeable: 브랜치를 타깃 브랜치에 충돌 없이 병합할 수 있습니다. -
merge_request_blocked: 다른 머지 리퀘스트에 의해 차단되어 있습니다. -
merge_time: 지정된 시간 이후에만 병합할 수 있습니다. -
need_rebase: 머지 리퀘스트를 리베이스해야 합니다. -
not_approved: 병합 전에 승인이 필요합니다. -
not_open: 병합 전에 머지 리퀘스트가 열려 있어야 합니다. -
preparing: 머지 리퀘스트 diff가 생성 중입니다. -
requested_changes: 머지 리퀘스트에 변경 사항을 요청한 리뷰어가 있습니다. -
security_policy_pipeline_check: 보안 정책이 적용된 경우, 머지 리퀘스트가 병합되기 전에 최신 커밋에 대한 모든 파이프라인이 성공해야 합니다. -
security_policy_violations: 모든 보안 정책을 충족해야 합니다. -
status_checks_must_pass: 병합 전에 모든 상태 검사를 통과해야 합니다. -
unchecked: Git이 아직 유효한 병합이 가능한지 테스트하지 않았습니다. -
locked_paths: 기본 브랜치에 병합하기 전에 다른 사용자가 잠근 경로의 잠금을 해제해야 합니다. -
locked_lfs_files: 병합 전에 다른 사용자가 잠근 LFS 파일의 잠금을 해제해야 합니다. -
title_regex: 프로젝트 설정에서 구성된 경우, 제목이 예상된 정규식과 일치하는지 확인합니다.
준비 단계#
prepared_at 필드는 다음 단계가 완료된 후 단 한 번만 채워집니다:
-
diff 생성.
-
파이프라인 생성.
-
병합 가능 여부 확인.
-
모든 Git LFS 오브젝트 연결.
-
알림 전송.
머지 리퀘스트에 추가 변경 사항이 추가되어도 prepared_at 필드는 업데이트되지 않습니다.
머지 리퀘스트 참여자 조회#
머지 리퀘스트의 참여자를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/participants
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
응답 예시:
[
{
"id": 1,
"name": "John Doe1",
"username": "user1",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
"web_url": "http://localhost/user1"
},
{
"id": 2,
"name": "John Doe2",
"username": "user2",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80&d=identicon",
"web_url": "http://localhost/user2"
}
]
머지 리퀘스트 리뷰어 조회#
머지 리퀘스트의 리뷰어를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/reviewers
지원되는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | 예 | 머지 리퀘스트의 내부 ID. |
응답 예시:
[
{
"user": {
"id": 1,
"name": "John Doe1",
"username": "user1",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
"web_url": "http://localhost/user1"
},
"state": "unreviewed",
"created_at": "2022-07-27T17:03:27.684Z"
},
{
"user": {
"id": 2,
"name": "John Doe2",
"username": "user2",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80&d=identicon",
"web_url": "http://localhost/user2"
},
"state": "reviewed",
"created_at": "2022-07-27T17:03:27.684Z"
}
]
머지 리퀘스트 커밋 조회#
머지 리퀘스트의 커밋을 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/commits
지원되는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | 예 | 머지 리퀘스트의 내부 ID. |
성공 시 200 OK와 다음 응답 속성을 반환합니다:
| 속성 | 타입 | 설명 |
|---|---|---|
| commits | object array | 머지 리퀘스트의 커밋 목록. |
| commits[].id | string | 커밋의 ID. |
| commits[].short_id | string | 커밋의 단축 ID. |
| commits[].created_at | datetime | committed_date 필드와 동일. |
| commits[].parent_ids | array | 부모 커밋의 ID 목록. |
| commits[].title | string | 커밋 제목. |
| commits[].message | string | 커밋 메시지. |
| commits[].author_name | string | 커밋 작성자의 이름. |
| commits[].author_email | string | 커밋 작성자의 이메일 주소. |
| commits[].authored_date | datetime | 커밋 작성 날짜 및 시간. |
| commits[].committer_name | string | 커밋터의 이름. |
| commits[].committer_email | string | 커밋터의 이메일 주소. |
| commits[].committed_date | datetime | 커밋 날짜 및 시간. |
| commits[].trailers | object | 커밋에 대해 파싱된 Git 트레일러. 중복 키는 마지막 값만 포함됩니다. |
| commits[].extended_trailers | object | 커밋에 대해 파싱된 Git 트레일러. |
| commits[].web_url | string | 머지 리퀘스트의 웹 URL. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/commits"
응답 예시:
[
{
"id": "ed899a2f4b50b4370feeea94676502b42383c746",
"short_id": "ed899a2f4b5",
"title": "Replace sanitize with escape once",
"author_name": "Example User",
"author_email": "user@example.com",
"authored_date": "2012-09-20T11:50:22+03:00",
"committer_name": "Example User",
"committer_email": "user@example.com",
"committed_date": "2012-09-20T11:50:22+03:00",
"created_at": "2012-09-20T11:50:22+03:00",
"message": "Replace sanitize with escape once",
"trailers": {},
"extended_trailers": {},
"web_url": "https://gitlab.example.com/project/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
},
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "Example User",
"author_email": "user@example.com",
"authored_date": "2012-09-20T09:06:12+03:00",
"committer_name": "Example User",
"committer_email": "user@example.com",
"committed_date": "2012-09-20T09:06:12+03:00",
"created_at": "2012-09-20T09:06:12+03:00",
"message": "Sanitize for network graph",
"trailers": {},
"extended_trailers": {},
"web_url": "https://gitlab.example.com/project/-/commit/6104942438c14ec7bd21c6cd5bd995272b3faff6"
}
]
머지 리퀘스트 의존성 조회#
머지 리퀘스트가 병합되기 전에 해결되어야 하는 의존성을 조회합니다.
사용자가 차단 중인 머지 리퀘스트에 접근할 수 없는 경우, `blocking_merge_request`
attribute는 반환되지 않습니다.
GET /projects/:id/merge_requests/:merge_request_iid/blocks
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blocks"
응답 예시:
[
{
"id": 1,
"blocking_merge_request": {
"id": 145,
"iid": 12,
"project_id": 7,
"title": "Interesting MR",
"description": "Does interesting things.",
"state": "opened",
"created_at": "2024-07-05T21:29:11.172Z",
"updated_at": "2024-07-05T21:29:11.172Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"merge_after": "2018-09-07T11:16:00.000Z",
"closed_by": null,
"closed_at": null,
"target_branch": "master",
"source_branch": "v2.x",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"assignees": [
{
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
}
],
"assignee": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"reviewers": [
{
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
{
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/root"
}
],
"source_project_id": 7,
"target_project_id": 7,
"labels": [],
"draft": false,
"imported": false,
"imported_from": "none",
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "unchecked",
"detailed_merge_status": "unchecked",
"sha": "ce7e4f2d0ce13cb07479bb39dc10ee3b861c08a6",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"prepared_at": null,
"reference": "!12",
"references": {
"short": "!12",
"relative": "!12",
"full": "my-group/my-project!12"
},
"web_url": "https://localhost/my-group/my-project/-/merge_requests/12",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
"blocked_merge_request": {
"id": 146,
"iid": 13,
"project_id": 7,
"title": "Really cool MR",
"description": "Adds some stuff",
"state": "opened",
"created_at": "2024-07-05T21:31:34.811Z",
"updated_at": "2024-07-27T02:57:08.054Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"merge_after": "2018-09-07T11:16:00.000Z",
"closed_by": null,
"closed_at": null,
"target_branch": "master",
"source_branch": "remove-from",
"user_notes_count": 0,
"upvotes": 1,
"downvotes": 0,
"author": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"assignees": [
{
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhose/aiguy123"
}
],
"assignee": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"reviewers": [
{
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/root"
}
],
"source_project_id": 7,
"target_project_id": 7,
"labels": [],
"draft": false,
"imported": false,
"imported_from": "none",
"work_in_progress": false,
"milestone": {
"id": 59,
"iid": 6,
"project_id": 7,
"title": "Sprint 1718897375",
"description": "Accusantium omnis iusto a animi.",
"state": "active",
"created_at": "2024-06-20T15:29:35.739Z",
"updated_at": "2024-06-20T15:29:35.739Z",
"due_date": null,
"start_date": null,
"expired": false,
"web_url": "https://localhost/my-group/my-project/-/milestones/6"
},
"merge_when_pipeline_succeeds": false,
"merge_status": "cannot_be_merged",
"detailed_merge_status": "not_approved",
"sha": "daa75b9b17918f51f43866ff533987fda71375ea",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"prepared_at": "2024-07-11T18:50:46.215Z",
"reference": "!13",
"references": {
"short": "!13",
"relative": "!13",
"full": "my-group/my-project!12"
},
"web_url": "https://localhost/my-group/my-project/-/merge_requests/13",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": true,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
"project_id": 7
}
]
머지 리퀘스트 의존성 삭제#
머지 리퀘스트 의존성을 삭제합니다.
DELETE /projects/:id/merge_requests/:merge_request_iid/blocks/:block_id
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project owned by the authenticated user. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
| block_id | integer | Yes | The ID of the block. |
요청 예시:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blocks/1"
반환 값:
-
의존성이 성공적으로 삭제되면
204 No Content를 반환합니다. -
사용자에게 머지 리퀘스트 업데이트 권한이 없으면
403 Forbidden을 반환합니다. -
사용자에게 차단 머지 리퀘스트 읽기 권한이 없으면
403 Forbidden을 반환합니다.
머지 리퀘스트 의존성 생성#
머지 리퀘스트 의존성을 생성합니다.
POST /projects/:id/merge_requests/:merge_request_iid/blocks
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project owned by the authenticated user. |
| merge_request_iid | integer | Yes | The internal ID of the merge request to be blocked. |
| blocking_merge_request_id | integer | Conditional | The global ID of the blocking merge request. Required if blocking_merge_request_iid is not provided. |
| blocking_merge_request_iid | integer | Conditional | The IID of the blocking merge request. Required if blocking_merge_request_id is not provided. |
| blocking_project_id | integer or string | No | The ID or URL-encoded path of the project that contains the blocking merge request. Required when blocking_merge_request_iid refers to a merge request in a different project. Defaults to the current project. |
IID를 사용한 요청 예시 (동일 프로젝트):
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blocks?blocking_merge_request_iid=2"
IID를 사용한 요청 예시 (크로스 프로젝트):
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blocks?blocking_merge_request_iid=5&blocking_project_id=2"
글로벌 ID를 사용한 요청 예시 (레거시 방식):
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blocks?blocking_merge_request_id=12345"
반환 값:
-
의존성이 성공적으로 생성되면
201 Created를 반환합니다. -
차단 머지 리퀘스트 저장에 실패하면
400 Bad request를 반환합니다. -
사용자에게 차단 머지 리퀘스트 읽기 권한이 없으면
403 Forbidden을 반환합니다. -
차단 머지 리퀘스트를 찾을 수 없으면
404 Not found를 반환합니다. -
블록이 이미 존재하면
409 Conflict를 반환합니다.
응답 예시:
{
"id": 1,
"blocking_merge_request": {
"id": 145,
"iid": 12,
"project_id": 7,
"title": "Interesting MR",
"description": "Does interesting things.",
"state": "opened",
"created_at": "2024-07-05T21:29:11.172Z",
"updated_at": "2024-07-05T21:29:11.172Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"merge_after": "2018-09-07T11:16:00.000Z",
"closed_by": null,
"closed_at": null,
"target_branch": "master",
"source_branch": "v2.x",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"assignees": [
{
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
}
],
"assignee": {
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
"reviewers": [
{
"id": 2,
"username": "aiguy123",
"name": "AI GUY",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/aiguy123"
},
{
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
"web_url": "https://localhost/root"
}
],
"source_project_id": 7,
"target_project_id": 7,
"labels": [],
"draft": false,
"imported": false,
"imported_from": "none",
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "unchecked",
"detailed_merge_status": "unchecked",
"sha": "ce7e4f2d0ce13cb07479bb39dc10ee3b861c08a6",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"prepared_at": null,
"reference": "!12",
"references": {
"short": "!12",
"relative": "!12",
"full": "my-group/my-project!12"
},
"web_url": "https://localhost/my-group/my-project/-/merge_requests/12",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
"project_id": 7
}
차단된 머지 리퀘스트 조회#
머지 리퀘스트에 의해 차단된 머지 리퀘스트를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/blockees
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/blockees"
응답 예시:
[
{
"id": 18,
"blocking_merge_request": {
"id": 71,
"iid": 10,
"project_id": 7,
"title": "At quaerat occaecati voluptate ex explicabo nisi.",
"description": "Aliquid distinctio officia corrupti ad nemo natus ipsum culpa.",
"state": "merged",
"created_at": "2024-07-05T19:44:14.023Z",
"updated_at": "2024-07-05T19:44:14.023Z",
"merged_by": {
"id": 40,
"username": "i-user-0-1720208283",
"name": "I User0",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/8325417f0f7919e3724957543b4414fdeca612cade1e4c0be45685fdaa2be0e2?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/i-user-0-1720208283"
},
"merge_user": {
"id": 40,
"username": "i-user-0-1720208283",
"name": "I User0",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/8325417f0f7919e3724957543b4414fdeca612cade1e4c0be45685fdaa2be0e2?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/i-user-0-1720208283"
},
"merged_at": "2024-06-26T19:44:14.123Z",
"closed_by": null,
"closed_at": null,
"target_branch": "master",
"source_branch": "Brickwood-Brunefunc-417",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 40,
"username": "i-user-0-1720208283",
"name": "I User0",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/8325417f0f7919e3724957543b4414fdeca612cade1e4c0be45685fdaa2be0e2?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/i-user-0-1720208283"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 7,
"target_project_id": 7,
"labels": [],
"draft": false,
"imported": false,
"imported_from": "none",
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"merge_after": null,
"sha": null,
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"prepared_at": null,
"reference": "!10",
"references": {
"short": "!10",
"relative": "!10",
"full": "flightjs/Flight!10"
},
"web_url": "http://127.0.0.1:3000/flightjs/Flight/-/merge_requests/10",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
"blocked_merge_request": {
"id": 176,
"iid": 14,
"project_id": 7,
"title": "second_mr",
"description": "Signed-off-by: Lucas Zampieri <lzampier@redhat.com>",
"state": "opened",
"created_at": "2024-07-08T19:12:29.089Z",
"updated_at": "2024-08-27T19:27:17.045Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "master",
"source_branch": "second_mr",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/fc3634394c590e212d964e8e0a34c4d9b8c17c992f4d6d145d75f9c21c1c3b6e?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/root"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 7,
"target_project_id": 7,
"labels": [],
"draft": false,
"imported": false,
"imported_from": "none",
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "cannot_be_merged",
"detailed_merge_status": "commits_status",
"merge_after": null,
"sha": "3a576801e528db79a75fbfea463673054ff224fb",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"prepared_at": null,
"reference": "!14",
"references": {
"short": "!14",
"relative": "!14",
"full": "flightjs/Flight!14"
},
"web_url": "http://127.0.0.1:3000/flightjs/Flight/-/merge_requests/14",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"squash_on_merge": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": true,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
"project_id": 7
}
]
머지 리퀘스트 변경 사항 조회#
이 엔드포인트는 GitLab 15.7에서 [더 이상 사용되지 않는(deprecated)](https://gitlab.com/gitlab-org/gitlab/-/issues/322117) 것으로 표시되었으며
API v5에서 제거될 예정입니다. 대신 머지 리퀘스트 diff 목록 조회 엔드포인트를 사용하세요.
파일 및 변경 사항을 포함한 머지 리퀘스트에 대한 정보를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/changes
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
| access_raw_diffs | boolean | No | Retrieve change diffs through Gitaly. |
| unidiff | boolean | No | Present change diffs in the unified diff format. Default is false. Introduced in GitLab 16.5. |
변경 집합과 연관된 diff는 API가 반환하거나 UI에서 조회할 때 적용되는 것과 동일한 크기 제한이 적용됩니다. 이러한 제한이 결과에 영향을 미칠 경우, overflow 필드에 true 값이 포함됩니다. 데이터베이스가 아닌 Gitaly에서 직접 diff에 접근하는 access_raw_diffs 파라미터를 추가하면 이러한 제한 없이 diff 데이터를 조회할 수 있습니다.
이 방식은 일반적으로 더 느리고 리소스를 더 많이 사용하지만, 데이터베이스 기반 diff에 적용되는 크기 제한을 받지 않습니다. 단, Gitaly 자체에 내재된 제한은 여전히 적용됩니다.
응답 예시:
{
"id": 21,
"iid": 1,
"project_id": 4,
"title": "Blanditiis beatae suscipit hic assumenda et molestias nisi asperiores repellat et.",
"state": "reopened",
"created_at": "2015-02-02T19:49:39.159Z",
"updated_at": "2015-02-02T20:08:49.959Z",
"target_branch": "secret_token",
"source_branch": "version-1-9",
"upvotes": 0,
"downvotes": 0,
"author": {
"name": "Chad Hamill",
"username": "jarrett",
"id": 5,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/b95567800f828948baf5f4160ebb2473?s=40&d=identicon",
"web_url" : "https://gitlab.example.com/jarrett"
},
"assignee": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40&d=identicon",
"web_url" : "https://gitlab.example.com/root"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 4,
"target_project_id": 4,
"labels": [ ],
"description": "Qui voluptatibus placeat ipsa alias quasi. Deleniti rem ut sint. Optio velit qui distinctio.",
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 4,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": null
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "mergeable",
"subscribed" : true,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"changes_count": "1",
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"squash": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"discussion_locked": false,
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"task_completion_status":{
"count":0,
"completed_count":0
},
"changes": [
{
"old_path": "VERSION",
"new_path": "VERSION",
"a_mode": "100644",
"b_mode": "100644",
"diff": "@@ -1 +1 @@\ -1.9.7\ +1.9.8",
"new_file": false,
"renamed_file": false,
"deleted_file": false
}
],
"overflow": false
}
머지 리퀘스트 diff 목록 조회#
History
-
generated_file은 GitLab 16.9에서collapse_generated_diff_files라는 플래그와 함께 도입됨. 기본적으로 비활성화됨. with a flag -
GitLab 16.10에서 GitLab.com 및 GitLab Self-Managed에 활성화됨.
-
generated_file은 GitLab 16.11에서 일반적으로 사용 가능해짐. 기능 플래그collapse_generated_diff_files제거됨. -
collapsed및too_large응답 속성이 GitLab 18.4에서 도입됨.
머지 리퀘스트에서 변경된 파일의 diff 목록을 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/diffs
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
| page | integer | No | The page of results to return. Defaults to 1. |
| per_page | integer | No | The number of results per page. Defaults to 20. |
| unidiff | boolean | No | Present diffs in the unified diff format. Default is false. Introduced in GitLab 16.5. |
성공 시 200 OK와 함께
다음 응답 속성을 반환합니다:
| Attribute | Type | Description |
|---|---|---|
| a_mode | string | Old file mode of the file. |
| b_mode | string | New file mode of the file. |
| collapsed | boolean | File diffs are excluded but can be fetched on request. |
| deleted_file | boolean | File has been removed. |
| diff | string | Diff representation of the changes made to the file. |
| generated_file | boolean | File is marked as generated. |
| new_file | boolean | File has been added. |
| new_path | string | New path of the file. |
| old_path | string | Old path of the file. |
| renamed_file | boolean | File has been renamed. |
| too_large | boolean | File diffs are excluded and cannot be retrieved. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/diffs?page=1&per_page=2"
응답 예시:
[
{
"old_path": "README",
"new_path": "README",
"a_mode": "100644",
"b_mode": "100644",
"diff": "@@ -1 +1 @@\ -Title\ +README",
"collapsed": false,
"too_large": false,
"new_file": false,
"renamed_file": false,
"deleted_file": false,
"generated_file": false
},
{
"old_path": "VERSION",
"new_path": "VERSION",
"a_mode": "100644",
"b_mode": "100644",
"diff": "@@\ -1.9.7\ +1.9.8",
"collapsed": false,
"too_large": false,
"new_file": false,
"renamed_file": false,
"deleted_file": false,
"generated_file": false
}
]
이 엔드포인트는 [머지 리퀘스트 diff 제한](/19.1/administration/instance_limits/#diff-limits)의 적용을 받습니다.
diff 제한을 초과하는 머지 리퀘스트는 제한된 결과를 반환합니다.
머지 리퀘스트 원시 diff 조회#
머지 리퀘스트에서 변경된 파일의 원시 diff를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/raw_diffs
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
성공 시 200 OK와 함께 프로그래밍 방식으로 사용할 수 있는 원시 diff 응답을 반환합니다:
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/raw_diffs"
응답 예시:
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 31525ad523553c8d7eff163db3e539058efd6d3a..f30e36d6fdf4cd4fa25f62e08ecdbf4a7b169681 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -944,6 +944,10 @@ def send_git_blob(repository, blob)
body ''
end
+ def send_git_diff(repository, diff_refs)
+ header(*Gitlab::Workhorse.send_git_diff(repository, diff_refs))
+ end
+
def send_git_archive(repository, **kwargs)
header(*Gitlab::Workhorse.send_git_archive(repository, **kwargs))
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index e02d9eea1852f19fe5311acda6aa17465eeb422e..f32b38585398a18fea75c11d7b8ebb730eeb3fab 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -6,6 +6,8 @@ class MergeRequests < ::API::Base
include PaginationParams
include Helpers::Unidiff
+ helpers ::API::Helpers::HeadersHelpers
+
CONTEXT_COMMITS_POST_LIMIT = 20
before { authenticate_non_get! }
이 엔드포인트는 [머지 리퀘스트 diff 제한](/19.1/administration/instance_limits/#diff-limits)의 적용을 받습니다.
diff 제한을 초과하는 머지 리퀘스트는 제한된 결과를 반환합니다.
머지 리퀘스트 파이프라인 목록 조회#
머지 리퀘스트의 모든 파이프라인을 나열합니다.
GET /projects/:id/merge_requests/:merge_request_iid/pipelines
지원하는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
머지 리퀘스트 파이프라인 목록을 제한하려면 페이지네이션 파라미터인 page와
per_page를 사용하세요.
응답 예시:
[
{
"id": 77,
"sha": "959e04d7c7a30600c894bd3c0cd0e1ce7f42c11d",
"ref": "main",
"status": "success"
}
]
머지 리퀘스트 파이프라인 생성#
머지 리퀘스트를 위한 새 파이프라인을 생성합니다.
이 엔드포인트로 생성된 파이프라인은 일반 브랜치/태그 파이프라인을 실행하지 않습니다.
job을 생성하려면 .gitlab-ci.yml에 only: [merge_requests]를 설정하세요.
새 파이프라인은 다음 중 하나가 될 수 있습니다:
-
분리된(detached) 머지 리퀘스트 파이프라인.
POST /projects/:id/merge_requests/:merge_request_iid/pipelines
지원하는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
응답 예시:
{
"id": 2,
"sha": "b83d6e391c22777fca1ed3012fce84f633d7fed0",
"ref": "refs/merge-requests/1/head",
"status": "pending",
"web_url": "http://localhost/user1/project1/pipelines/2",
"before_sha": "0000000000000000000000000000000000000000",
"tag": false,
"yaml_errors": null,
"user": {
"id": 1,
"name": "John Doe1",
"username": "user1",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
"web_url": "http://example.com"
},
"created_at": "2019-09-04T19:20:18.267Z",
"updated_at": "2019-09-04T19:20:18.459Z",
"started_at": null,
"finished_at": null,
"committed_at": null,
"duration": null,
"coverage": null,
"detailed_status": {
"icon": "status_pending",
"text": "pending",
"label": "pending",
"group": "pending",
"tooltip": "pending",
"has_details": false,
"details_path": "/user1/project1/pipelines/2",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_pending-5bdf338420e5221ca24353b6bff1c9367189588750632e9a871b7af09ff6a2ae.png"
},
"archived": false
}
머지 리퀘스트 생성#
새 머지 리퀘스트를 생성합니다.
POST /projects/:id/merge_requests
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | 정수 또는 문자열 | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로 |
| source_branch | 문자열 | Yes | 소스 브랜치. |
| target_branch | 문자열 | Yes | 타깃 브랜치. |
| title | 문자열 | Yes | 머지 리퀘스트 제목. |
| allow_collaboration | 불리언 | No | 타깃 브랜치에 머지할 수 있는 멤버의 커밋을 허용합니다. |
| approvals_before_merge | 정수 | No | 이 머지 리퀘스트가 머지되기 전에 필요한 승인 수입니다(아래 참조). 승인 규칙을 구성하려면 머지 리퀘스트 승인 API를 참조하세요. GitLab 16.0에서 Deprecated 됨. Premium 및 Ultimate 전용. |
| allow_maintainer_to_push | 불리언 | No | allow_collaboration의 별칭. |
| assignee_id | 정수 | No | 담당자 사용자 ID. |
| assignee_ids | 정수 배열 | No | 머지 리퀘스트를 할당할 사용자의 ID. 모든 담당자를 해제하려면 0으로 설정하거나 빈 값을 입력하세요. |
| description | 문자열 | No | 머지 리퀘스트 설명. 1,048,576자로 제한됩니다. |
| labels | 문자열 | No | 머지 리퀘스트에 대한 라벨로, 쉼표로 구분된 목록입니다. 라벨이 아직 존재하지 않으면 새 프로젝트 라벨을 생성하여 머지 리퀘스트에 할당합니다. |
| merge_after | 문자열 | No | 머지 리퀘스트를 머지할 수 있는 날짜. GitLab 17.8에서 도입됨. |
| milestone_id | 정수 | No | 마일스톤의 글로벌 ID. milestone과 상호 배타적. |
| milestone | 문자열 | No | 머지 리퀘스트를 할당할 프로젝트 또는 상위 그룹 마일스톤의 제목. 대소문자를 구분하여 정확히 일치. milestone_id와 상호 배타적. |
| remove_source_branch | 불리언 | No | 머지 시 소스 브랜치를 삭제할지 여부를 나타내는 플래그. |
| reviewer_ids | 정수 배열 | No | 머지 리퀘스트에 검토자로 추가된 사용자의 ID. 0으로 설정하거나 비워두면 검토자가 추가되지 않습니다. |
| squash | 불리언 | No | true이면 머지 시 모든 커밋을 단일 커밋으로 스쿼시합니다. 제공하지 않으면 프로젝트의 스쿼시 옵션 설정이 기본값으로 사용됩니다. 프로젝트 설정이 머지 시 이 값을 재정의할 수 있습니다. |
| target_project_id | 정수 | No | 타깃 프로젝트의 숫자 ID. |
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"imported": false,
"imported_from": "none",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
응답 데이터에 관한 중요 사항은 단일 머지 리퀘스트 응답 노트를 참고하세요.
머지 리퀘스트 업데이트#
기존 머지 리퀘스트를 업데이트합니다.
PUT /projects/:id/merge_requests/:merge_request_iid
| 속성 | 유형 | 필수 여부 | 설명 |
|---|---|---|---|
| id | 정수 또는 문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | 정수 | 예 | 머지 리퀘스트의 ID. |
| add_labels | 문자열 | 아니요 | 머지 리퀘스트에 추가할 쉼표로 구분된 라벨 이름. 라벨이 아직 존재하지 않으면 새 프로젝트 라벨을 생성하고 머지 리퀘스트에 할당합니다. |
| allow_collaboration | 불리언 | 아니요 | 타깃 브랜치에 머지할 수 있는 멤버의 커밋을 허용합니다. |
| allow_maintainer_to_push | 불리언 | 아니요 | allow_collaboration의 별칭. |
| assignee_id | 정수 | 아니요 | 머지 리퀘스트를 할당할 사용자의 ID. 모든 담당자를 해제하려면 0으로 설정하거나 빈 값을 입력하세요. |
| assignee_ids | 정수 배열 | 아니요 | 머지 리퀘스트를 할당할 사용자들의 ID. 모든 담당자를 해제하려면 0으로 설정하거나 빈 값을 입력하세요. |
| description | 문자열 | 아니요 | 머지 리퀘스트의 설명. 최대 1,048,576자로 제한됩니다. |
| discussion_locked | 불리언 | 아니요 | 머지 리퀘스트의 토론이 잠겨 있는지 여부를 나타내는 플래그. 잠긴 토론에는 프로젝트 멤버만 댓글을 추가, 편집, 해결할 수 있습니다. |
| labels | 문자열 | 아니요 | 머지 리퀘스트에 대한 쉼표로 구분된 라벨 이름. 모든 라벨을 해제하려면 빈 문자열로 설정하세요. 라벨이 아직 존재하지 않으면 새 프로젝트 라벨을 생성하고 머지 리퀘스트에 할당합니다. |
| merge_after | 문자열 | 아니요 | 머지 리퀘스트가 머지될 수 있는 날짜 이후. GitLab 17.8에서 도입됨. |
| milestone_id | 정수 | 아니요 | 머지 리퀘스트에 할당할 마일스톤의 글로벌 ID. 마일스톤을 해제하려면 0으로 설정하거나 빈 값을 입력하세요. milestone과 함께 사용할 수 없습니다. |
| milestone | 문자열 | 아니요 | 머지 리퀘스트에 할당할 프로젝트 또는 상위 그룹 마일스톤의 제목. 정확히 일치(대소문자 구분)해야 합니다. milestone_id와 함께 사용할 수 없습니다. |
| remove_labels | 문자열 | 아니요 | 머지 리퀘스트에서 제거할 쉼표로 구분된 라벨 이름. |
| remove_source_branch | 불리언 | 아니요 | 머지 시 소스 브랜치를 제거할지 여부를 나타내는 플래그. |
| reviewer_ids | 정수 배열 | 아니요 | 머지 리퀘스트의 리뷰어로 설정할 사용자들의 ID. 모든 리뷰어를 해제하려면 0으로 설정하거나 빈 값을 입력하세요. |
| squash | 불리언 | 아니요 | true이면 머지 시 모든 커밋을 하나의 커밋으로 스쿼시합니다. 값을 제공하지 않으면 프로젝트의 스쿼시 옵션 설정이 기본값으로 사용됩니다. 프로젝트가 스쿼시를 필수(Require) 또는 허용 안 함(Do not allow)으로 설정한 경우, 머지 시 해당 설정이 우선 적용됩니다. |
| state_event | 문자열 | 아니요 | 새 상태 (close/reopen). |
| target_branch | 문자열 | 아니요 | 타깃 브랜치. |
| title | 문자열 | 아니요 | 머지 리퀘스트의 제목. |
필수가 아닌 속성 중 하나 이상을 포함해야 합니다.
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
응답 데이터에 관한 중요 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 확인하세요.
머지 리퀘스트 삭제#
머지 리퀘스트를 삭제합니다. 관리자 및 프로젝트 Owner만 머지 리퀘스트를 삭제할 수 있습니다.
DELETE /projects/:id/merge_requests/:merge_request_iid
| 속성 | 타입 | 필수 | 설명 |
|---|---|---|---|
| id | 정수 또는 문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | 정수 | 예 | 머지 리퀘스트의 내부 ID. |
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/4/merge_requests/85"
머지 리퀘스트 머지#
History
- 머지 트레인이 활성화된 프로젝트에서
auto_merge요청을 머지 트레인으로 라우팅하는 동작이 GitLab 19.1에서fix_merge_api_train_bypass라는 이름의 기능 플래그와 함께 변경됨. 기본적으로 비활성화됨. 머지 리퀘스트는 직접 머지되는 대신 머지 트레인에 추가됩니다.
이 API를 사용하여 머지 리퀘스트에 제출된 변경 사항을 수락하고 머지합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/merge
지원되는 속성:
| 속성 | 타입 | 필수 | 설명 |
|---|---|---|---|
| id | 정수 또는 문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | 정수 | 예 | 머지 리퀘스트의 내부 ID. |
| auto_merge | 불리언 | 아니요 | true이면 검사가 통과될 때 머지 리퀘스트가 머지됩니다. |
| merge_commit_message | 문자열 | 아니요 | 사용자 지정 머지 커밋 메시지. |
| merge_when_pipeline_succeeds | 불리언 | 아니요 | GitLab 17.11에서 더 이상 사용되지 않습니다. 대신 auto_merge를 사용하세요. |
| sha | 문자열 | 아니요 | 값이 있으면 이 SHA가 소스 브랜치의 HEAD와 일치해야 합니다. 검토된 커밋만 머지되도록 보장하는 데 사용합니다. |
| should_remove_source_branch | 불리언 | 아니요 | true이면 소스 브랜치를 삭제합니다. |
| squash_commit_message | 문자열 | 아니요 | 사용자 지정 스쿼시 커밋 메시지. |
| squash | 불리언 | 아니요 | true이면 머지 시 모든 커밋을 단일 커밋으로 스쿼시합니다. |
이 API는 실패 시 특정 HTTP 상태 코드를 반환합니다:
| HTTP 상태 | 메시지 | 원인 |
|---|---|---|
| 401 | 401 Unauthorized | 이 사용자는 이 머지 리퀘스트를 수락할 권한이 없습니다. |
| 405 | 405 Method Not Allowed | 머지 리퀘스트를 머지할 수 없습니다. |
| 409 | SHA does not match HEAD of source branch | 제공된 sha 파라미터가 소스의 HEAD와 일치하지 않습니다. |
| 422 | Branch cannot be merged | 머지 리퀘스트 머지에 실패했습니다. |
응답 데이터에 관한 중요 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 확인하세요.
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
기본 머지 ref 경로로 머지#
머지 리퀘스트 소스 브랜치와 타깃 브랜치 간의 변경 내용을, 가능한 경우 타깃 프로젝트 리포지터리의 refs/merge-requests/:iid/merge
ref에 머지합니다. 이 ref는 일반적인 머지 작업을 수행했을 때 타깃 브랜치가 가지게 될 상태를 나타냅니다.
이 작업은 일반적인 머지 작업이 아니며, 어떤 방식으로도 머지 리퀘스트 타깃 브랜치의 상태를 변경하지 않습니다.
이 ref(refs/merge-requests/:iid/merge)는 이 API에 요청을 제출할 때 반드시 덮어써지는 것은 아니지만, ref가 최신 상태를 유지하도록 보장합니다.
GET /projects/:id/merge_requests/:merge_request_iid/merge_ref
지원되는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer or string | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
이 API는 다음과 같은 특정 HTTP 상태 코드를 반환합니다:
| HTTP 상태 | 메시지 | 이유 |
|---|---|---|
| 200 | (없음) | 성공. refs/merge-requests/:iid/merge의 HEAD 커밋을 반환합니다. |
| 400 | Merge request is not mergeable | 머지 리퀘스트에 충돌이 있습니다. |
| 400 | Merge ref cannot be updated | |
| 400 | Unsupported operation | GitLab 데이터베이스가 읽기 전용 모드입니다. |
응답 예시:
{
"commit_id": "854a3a7a17acbcc0bbbea170986df1eb60435f34"
}
파이프라인 성공 시 머지 취소#
POST /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds
지원되는 속성:
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer or string | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
이 API는 다음과 같은 특정 HTTP 상태 코드를 반환합니다:
| HTTP 상태 | 메시지 | 이유 |
|---|---|---|
| 201 | (없음) | 성공, 또는 머지 리퀘스트가 이미 머지된 경우. |
| 406 | Can't cancel the automatic merge | 머지 리퀘스트가 닫혀 있습니다. |
응답 데이터에 관한 중요 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 참조하세요.
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"merge_error": null,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
머지 리퀘스트 리베이스#
머지 리퀘스트의 source_branch를 target_branch에 대해 자동으로 리베이스합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/rebase
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
| skip_ci | boolean | No | Set to true to skip creating a CI pipeline. |
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/76/merge_requests/1/rebase"
이 API는 다음과 같은 특정 HTTP 상태 코드를 반환합니다:
| HTTP Status | Message | Reason |
|---|---|---|
| 202 | (no message) | 큐에 성공적으로 추가됨. |
| 403 | Cannot push to source branch | 머지 리퀘스트의 소스 브랜치에 푸시할 권한이 없습니다. |
| 403 | Source branch does not exist | 머지 리퀘스트의 소스 브랜치에 푸시할 권한이 없습니다. |
| 403 | Source branch is protected from force push | 머지 리퀘스트의 소스 브랜치에 푸시할 권한이 없습니다. |
| 409 | Failed to enqueue the rebase operation | 장기 실행 트랜잭션이 요청을 차단했을 수 있습니다. |
요청이 큐에 성공적으로 추가되면 응답에 다음이 포함됩니다:
{
"rebase_in_progress": true
}
머지 리퀘스트 조회 엔드포인트를 include_rebase_in_progress 파라미터와 함께 폴링하여 비동기 요청의 상태를 확인할 수 있습니다.
리베이스 작업이 진행 중인 경우 응답에 다음이 포함됩니다:
{
"rebase_in_progress": true,
"merge_error": null
}
리베이스 작업이 성공적으로 완료된 후 응답에 다음이 포함됩니다:
{
"rebase_in_progress": false,
"merge_error": null
}
리베이스 작업이 실패하면 응답에 다음이 포함됩니다:
{
"rebase_in_progress": false,
"merge_error": "Rebase failed. Please rebase locally"
}
머지 리퀘스트에 대한 댓글#
노트 리소스를 통해 댓글을 생성합니다.
머지 시 종료되는 이슈 목록#
머지 리퀘스트가 머지될 때 종료될 이슈 목록을 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/closes_issues
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | Internal ID of the merge request. |
성공 시 200 OK를 반환하며, GitLab 이슈 트래커를 사용하는 경우 다음 응답 속성을 반환합니다:
| Attribute | Type | Description |
|---|---|---|
| [].assignee | object | 이슈의 첫 번째 담당자. |
| [].assignees | array | 이슈의 담당자 목록. |
| [].author | object | 이슈를 생성한 사용자. |
| [].blocking_issues_count | integer | 이 이슈가 차단하는 이슈 수. |
| [].closed_at | datetime | 이슈가 종료된 시점의 타임스탬프. |
| [].closed_by | object | 이슈를 종료한 사용자. |
| [].confidential | boolean | 이슈가 기밀인지 여부를 나타냄. |
| [].created_at | datetime | 이슈가 생성된 시점의 타임스탬프. |
| [].description | string | 이슈 설명. |
| [].discussion_locked | boolean | 이슈의 댓글이 멤버 전용으로 잠겨 있는지 여부를 나타냄. |
| [].downvotes | integer | 이슈가 받은 비추천 수. |
| [].due_date | date | 이슈의 마감일. |
| [].id | integer | 이슈의 ID. |
| [].iid | integer | 이슈의 내부 ID. | | [].issue_type | string | 이슈 유형. issue, incident, test_case, requirement, task 중 하나일 수 있습니다. | | [].labels | array | 이슈의 라벨. | | [].merge_requests_count | integer | 머지 시 이슈를 종료하는 머지 리퀘스트 수. | | [].milestone | object | 이슈의 마일스톤. | | [].project_id | integer | 이슈 프로젝트의 ID. | | [].state | string | 이슈의 상태. opened 또는 closed일 수 있습니다. | | [].task_completion_status | object | count와 completed_count를 포함합니다. | | [].time_stats | object | 이슈의 시간 통계. time_estimate, total_time_spent, human_time_estimate, human_total_time_spent를 포함합니다. | | [].title | string | 이슈의 제목. | | [].type | string | 이슈의 유형. issue_type과 동일하지만 대문자로 표시됩니다. | | [].updated_at | datetime | 이슈가 업데이트된 시각의 타임스탬프. | | [].upvotes | integer | 이슈가 받은 추천 수. | | [].user_notes_count | integer | 이슈의 사용자 노트 수. | | [].web_url | string | 이슈의 웹 URL. | | [].weight | integer | 이슈의 가중치. |
성공하면 200 OK와 함께 Jira와 같은 외부 이슈 트래커를 사용할 때 다음
응답 속성을 반환합니다:
| Attribute | Type | Description |
|---|---|---|
| [].id | integer | ID of the issue. |
| [].title | string | Title of the issue. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/76/merge_requests/1/closes_issues"
GitLab 이슈 트래커를 사용할 때의 응답 예시:
[
{
"id": 76,
"iid": 6,
"project_id": 1,
"title": "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"description": "Ratione dolores corrupti mollitia soluta quia.",
"state": "opened",
"created_at": "2024-09-06T10:58:49.002Z",
"updated_at": "2024-09-06T11:01:40.710Z",
"closed_at": null,
"closed_by": null,
"labels": [
"label"
],
"milestone": {
"project_id": 1,
"description": "Ducimus nam enim ex consequatur cumque ratione.",
"state": "closed",
"due_date": null,
"iid": 2,
"created_at": "2016-01-04T15:31:39.996Z",
"title": "v4.0",
"id": 17,
"updated_at": "2016-01-04T15:31:39.996Z"
},
"assignees": [
{
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": null,
"web_url": "https://gitlab.example.com/root"
}
],
"author": {
"id": 18,
"username": "eileen.lowe",
"name": "Alexandra Bashirian",
"state": "active",
"locked": false,
"avatar_url": null,
"web_url": "https://gitlab.example.com/eileen.lowe"
},
"type": "ISSUE",
"assignee": {
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": null,
"web_url": "https://gitlab.example.com/root"
},
"user_notes_count": 1,
"merge_requests_count": 1,
"upvotes": 0,
"downvotes": 0,
"due_date": null,
"confidential": false,
"discussion_locked": null,
"issue_type": "issue",
"web_url": "https://gitlab.example.com/my-group/my-project/-/issues/6",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"weight": null,
"blocking_issues_count": 0
}
]
Jira와 같은 외부 이슈 트래커를 사용할 때의 응답 예시:
[
{
"id" : "PROJECT-123",
"title" : "Title of this issue"
}
]
머지 리퀘스트와 관련된 이슈 목록 조회#
머지 리퀘스트의 제목, 설명, 커밋 메시지, 댓글, 토론에서 관련 이슈를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/related_issues
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/76/merge_requests/1/related_issues"
GitLab 이슈 트래커를 사용할 때의 응답 예시:
[
{
"state" : "opened",
"description" : "Ratione dolores corrupti mollitia soluta quia.",
"author" : {
"state" : "active",
"id" : 18,
"web_url" : "https://gitlab.example.com/eileen.lowe",
"name" : "Alexandra Bashirian",
"avatar_url" : null,
"username" : "eileen.lowe"
},
"milestone" : {
"project_id" : 1,
"description" : "Ducimus nam enim ex consequatur cumque ratione.",
"state" : "closed",
"due_date" : null,
"iid" : 2,
"created_at" : "2016-01-04T15:31:39.996Z",
"title" : "v4.0",
"id" : 17,
"updated_at" : "2016-01-04T15:31:39.996Z"
},
"project_id" : 1,
"assignee" : {
"state" : "active",
"id" : 1,
"name" : "Administrator",
"web_url" : "https://gitlab.example.com/root",
"avatar_url" : null,
"username" : "root"
},
"updated_at" : "2016-01-04T15:31:51.081Z",
"id" : 76,
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"created_at" : "2016-01-04T15:31:51.081Z",
"iid" : 6,
"labels" : [],
"user_notes_count": 1,
"changes_count": "1"
}
]
Jira와 같은 외부 이슈 트래커를 사용할 때의 응답 예시:
[
{
"id" : "PROJECT-123",
"title" : "Title of this issue"
}
]
머지 리퀘스트 구독#
인증된 사용자를 머지 리퀘스트에 구독하여 알림을 수신하도록 합니다.
POST /projects/:id/merge_requests/:merge_request_iid/subscribe
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
사용자가 이미 머지 리퀘스트를 구독 중인 경우, 엔드포인트는
상태 코드 HTTP 304 Not Modified를 반환합니다.
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/17/subscribe"
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
응답 데이터에 관한 중요 사항은 단일 머지 리퀘스트 응답 참고 사항을 참조하세요.
머지 리퀘스트 구독 취소#
인증된 사용자가 머지 리퀘스트에서 알림을 받지 않도록 구독을 취소합니다.
POST /projects/:id/merge_requests/:merge_request_iid/unsubscribe
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/17/unsubscribe"
사용자가 머지 리퀘스트를 구독하지 않은 경우, 엔드포인트는
상태 코드 HTTP 304 Not Modified를 반환합니다.
응답 예시:
{
"id": 1,
"iid": 1,
"project_id": 3,
"title": "test1",
"description": "fixed login page css paddings",
"state": "merged",
"created_at": "2017-04-29T08:46:00Z",
"updated_at": "2017-04-29T08:46:00Z",
"target_branch": "main",
"source_branch": "test1",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignee": {
"id": 1,
"name": "Administrator",
"username": "admin",
"state": "active",
"avatar_url": null,
"web_url" : "https://gitlab.example.com/admin"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 2,
"target_project_id": 3,
"labels": [
"Community contribution",
"Manage"
],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 5,
"iid": 1,
"project_id": 3,
"title": "v2.0",
"description": "Assumenda aut placeat expedita exercitationem labore sunt enim earum.",
"state": "closed",
"created_at": "2015-02-02T19:49:26.013Z",
"updated_at": "2015-02-02T19:49:26.013Z",
"due_date": "2018-09-22",
"start_date": "2018-08-08",
"web_url": "https://gitlab.example.com/my-group/my-project/milestones/1"
},
"merge_when_pipeline_succeeds": true,
"merge_status": "can_be_merged",
"detailed_merge_status": "not_open",
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 1,
"discussion_locked": null,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"allow_collaboration": false,
"allow_maintainer_to_push": false,
"web_url": "http://gitlab.example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
},
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"subscribed": false,
"changes_count": "1",
"merged_by": { // Deprecated and will be removed in API v5, use `merge_user` instead
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merge_user": {
"id": 87854,
"name": "Douwe Maan",
"username": "DouweM",
"state": "active",
"avatar_url": "https://gitlab.example.com/uploads/-/system/user/avatar/87854/avatar.png",
"web_url": "https://gitlab.com/DouweM"
},
"merged_at": "2018-09-07T11:16:17.520Z",
"merge_after": "2018-09-07T11:16:00.000Z",
"prepared_at": "2018-09-04T11:16:17.520Z",
"closed_by": null,
"closed_at": null,
"latest_build_started_at": "2018-09-07T07:27:38.472Z",
"latest_build_finished_at": "2018-09-07T08:07:06.012Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 29626725,
"sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"ref": "patch-28",
"status": "success",
"web_url": "https://gitlab.example.com/my-group/my-project/pipelines/29626725"
},
"diff_refs": {
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",
"start_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00"
},
"diverged_commits_count": 2,
"task_completion_status":{
"count":0,
"completed_count":0
}
}
응답 데이터에 대한 중요한 참고 사항은 단일 머지 리퀘스트 응답 참고 사항을 확인하세요.
할 일 항목 생성#
현재 사용자에 대한 할 일 항목을 머지 리퀘스트에 수동으로 생성합니다.
해당 머지 리퀘스트에 대한 사용자의 할 일 항목이 이미 존재하는 경우, 이 엔드포인트는
상태 코드 HTTP 304 Not Modified를 반환합니다.
POST /projects/:id/merge_requests/:merge_request_iid/todo
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/27/todo"
응답 예시:
{
"id": 113,
"project": {
"id": 3,
"name": "GitLab CI/CD",
"name_with_namespace": "GitLab Org / GitLab CI/CD",
"path": "gitlab-ci",
"path_with_namespace": "gitlab-org/gitlab-ci"
},
"author": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "https://gitlab.example.com/root"
},
"action_name": "marked",
"target_type": "MergeRequest",
"target": {
"id": 27,
"iid": 7,
"project_id": 3,
"title": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.",
"description": "Veniam sunt nihil modi earum cumque illum delectus. Nihil ad quis distinctio quia. Autem eligendi at quibusdam repellendus.",
"state": "merged",
"created_at": "2016-06-17T07:48:04.330Z",
"updated_at": "2016-07-01T11:14:15.537Z",
"target_branch": "allow_regex_for_project_skip_ref",
"source_branch": "backup",
"upvotes": 0,
"downvotes": 0,
"author": {
"name": "Jarret O'Keefe",
"username": "francisca",
"id": 14,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
"web_url": "https://gitlab.example.com/francisca",
"discussion_locked": false
},
"assignee": {
"name": "Dr. Gabrielle Strosin",
"username": "barrett.krajcik",
"id": 4,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/733005fcd7e6df12d2d8580171ccb966?s=80&d=identicon",
"web_url": "https://gitlab.example.com/barrett.krajcik"
},
"assignees": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"reviewers": [{
"name": "Miss Monserrate Beier",
"username": "axel.block",
"id": 12,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
}],
"source_project_id": 3,
"target_project_id": 3,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": {
"id": 27,
"iid": 2,
"project_id": 3,
"title": "v1.0",
"description": "Quis ea accusantium animi hic fuga assumenda.",
"state": "active",
"created_at": "2016-06-17T07:47:33.840Z",
"updated_at": "2016-06-17T07:47:33.840Z",
"due_date": null
},
"merge_when_pipeline_succeeds": false,
"merge_status": "unchecked",
"detailed_merge_status": "not_open",
"subscribed": true,
"sha": "8888888888888888888888888888888888888888",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 7,
"changes_count": "1",
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"squash": false,
"web_url": "http://example.com/my-group/my-project/merge_requests/1",
"references": {
"short": "!1",
"relative": "!1",
"full": "my-group/my-project!1"
}
},
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/merge_requests/7",
"body": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.",
"state": "pending",
"created_at": "2016-07-01T11:14:15.530Z"
}
머지 리퀘스트 diff 버전 목록 조회#
머지 리퀘스트의 diff 버전 목록을 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/versions
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | String | Yes | 프로젝트의 ID. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
응답에 포함된 SHA에 대한 설명은 API 응답의 SHA를 참조하세요.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions"
응답 예시:
[{
"id": 110,
"head_commit_sha": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30",
"base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"created_at": "2016-07-26T14:44:48.926Z",
"merge_request_id": 105,
"state": "collected",
"real_size": "1",
"patch_id_sha": "d504412d5b6e6739647e752aff8e468dde093f2f"
}, {
"id": 108,
"head_commit_sha": "3eed087b29835c48015768f839d76e5ea8f07a24",
"base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"created_at": "2016-07-25T14:21:33.028Z",
"merge_request_id": 105,
"state": "collected",
"real_size": "1",
"patch_id_sha": "72c30d1f0115fc1d2bb0b29b24dc2982cbcdfd32"
}]
API 응답의 SHA#
| SHA 필드 | 목적 |
|---|---|
| base_commit_sha | 소스 브랜치와 타깃 브랜치 간의 머지 베이스 커밋 SHA. |
| head_commit_sha | 소스 브랜치의 HEAD 커밋. |
| start_commit_sha | 이 diff 버전이 생성될 당시 타깃 브랜치의 HEAD 커밋 SHA. |
머지 리퀘스트 diff 버전 단건 조회#
History
collapsed및too_large응답 속성이 GitLab 18.4에서 도입됨.
머지 리퀘스트의 특정 diff 버전을 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id
지원되는 속성:
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | String | Yes | 프로젝트의 ID. |
| merge_request_iid | integer | Yes | 머지 리퀘스트의 내부 ID. |
| version_id | integer | Yes | 머지 리퀘스트 diff 버전의 ID. |
| unidiff | boolean | No | diff를 unified diff 형식으로 표시합니다. 기본값은 false입니다. GitLab 16.5에서 도입됨. |
성공 시 200 OK와 다음
응답 속성을 반환합니다:
| Attribute | Type | Description |
|---|---|---|
| id | integer | 머지 리퀘스트 diff 버전의 ID. |
| base_commit_sha | string | 소스 브랜치와 타깃 브랜치 간의 머지 베이스 커밋 SHA. |
| commits | object array | 머지 리퀘스트 diff에 포함된 커밋 목록. |
| commits[].id | string | 커밋의 ID. |
| commits[].short_id | string | 커밋의 짧은 ID. |
| commits[].created_at | datetime | committed_date 필드와 동일. |
| commits[].parent_ids | array | 부모 커밋의 ID 목록. |
| commits[].title | string | 커밋 제목. |
| commits[].message | string | 커밋 메시지. |
| commits[].author_name | string | 커밋 작성자의 이름. |
| commits[].author_email | string | 커밋 작성자의 이메일 주소. |
| commits[].authored_date | datetime | 커밋 작성 날짜 및 시간. |
| commits[].committer_name | string | 커밋을 커밋한 사람의 이름. |
| commits[].committer_email | string | 커밋을 커밋한 사람의 이메일 주소. |
| commits[].committed_date | datetime | 커밋 날짜 및 시간. |
| commits[].trailers | object | 커밋에서 파싱된 Git 트레일러. 중복 키는 마지막 값만 포함. |
| commits[].extended_trailers | object | 커밋에서 파싱된 Git 트레일러. |
| commits[].web_url | string | 머지 리퀘스트의 웹 URL. |
| created_at | datetime | 머지 리퀘스트의 생성 날짜 및 시간. |
| diffs | object array | 머지 리퀘스트 diff 버전에 포함된 diff 목록. |
| diffs[].a_mode | string | 파일의 이전 파일 모드. |
| diffs[].b_mode | string | 파일의 새 파일 모드. |
| diffs[].collapsed | boolean | 파일 diff가 제외되었지만 요청 시 가져올 수 있음. |
| diffs[].deleted_file | boolean | 파일이 삭제됨. |
| diffs[].diff | string | diff의 내용. |
| diffs[].generated_file | boolean | 파일이 생성된 파일로 표시됨. |
| diffs[].new_file | boolean | 파일이 추가됨. |
| diffs[].new_path | string | 파일의 새 경로. |
| diffs[].old_path | string | 파일의 이전 경로. |
| diffs[].renamed_file | boolean | 파일 이름이 변경되었습니다. |
| diffs[].too_large | boolean | 파일 diff가 제외되어 검색할 수 없습니다. |
| head_commit_sha | string | 소스 브랜치의 HEAD 커밋입니다. |
| merge_request_id | integer | 머지 리퀘스트의 ID입니다. |
| patch_id_sha | string | 머지 리퀘스트 diff의 Patch ID입니다. |
| real_size | string | 머지 리퀘스트 diff의 변경 수입니다. |
| start_commit_sha | string | 이 버전의 diff가 생성될 때 타깃 브랜치의 HEAD 커밋 SHA입니다. |
| state | string | 머지 리퀘스트 diff의 상태입니다. collected, overflow, without_files 값을 가질 수 있습니다. 더 이상 사용되지 않는 값: timeout, overflow_commits_safe_size, overflow_diff_files_limit, overflow_diff_lines_limit. |
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions/1"
응답 예시:
{
"id": 110,
"head_commit_sha": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30",
"base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd",
"created_at": "2016-07-26T14:44:48.926Z",
"merge_request_id": 105,
"state": "collected",
"real_size": "1",
"patch_id_sha": "d504412d5b6e6739647e752aff8e468dde093f2f",
"commits": [{
"id": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30",
"short_id": "33e2ee85",
"parent_ids": [],
"title": "Change year to 2018",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2016-07-26T17:44:29.000+03:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2016-07-26T17:44:29.000+03:00",
"created_at": "2016-07-26T17:44:29.000+03:00",
"message": "Change year to 2018",
"trailers": {},
"extended_trailers": {},
"web_url": "https://gitlab.example.com/project/-/commit/33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30"
}, {
"id": "aa24655de48b36335556ac8a3cd8bb521f977cbd",
"short_id": "aa24655d",
"parent_ids": [],
"title": "Update LICENSE",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2016-07-25T17:21:53.000+03:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2016-07-25T17:21:53.000+03:00",
"created_at": "2016-07-25T17:21:53.000+03:00",
"message": "Update LICENSE",
"trailers": {},
"extended_trailers": {},
"web_url": "https://gitlab.example.com/project/-/commit/aa24655de48b36335556ac8a3cd8bb521f977cbd"
}, {
"id": "3eed087b29835c48015768f839d76e5ea8f07a24",
"short_id": "3eed087b",
"parent_ids": [],
"title": "Add license",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2016-07-25T17:21:20.000+03:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2016-07-25T17:21:20.000+03:00",
"created_at": "2016-07-25T17:21:20.000+03:00",
"message": "Add license",
"trailers": {},
"extended_trailers": {},
"web_url": "https://gitlab.example.com/project/-/commit/3eed087b29835c48015768f839d76e5ea8f07a24"
}],
"diffs": [{
"old_path": "LICENSE",
"new_path": "LICENSE",
"a_mode": "0",
"b_mode": "100644",
"diff": "@@ -0,0 +1,21 @@\n+The MIT License (MIT)\n+\n+Copyright (c) 2018 Administrator\n+\n+Permission is hereby granted, free of charge, to any person obtaining a copy\n+of this software and associated documentation files (the \"Software\"), to deal\n+in the Software without restriction, including without limitation the rights\n+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+copies of the Software, and to permit persons to whom the Software is\n+furnished to do so, subject to the following conditions:\n+\n+The above copyright notice and this permission notice shall be included in all\n+copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+SOFTWARE.\n",
"collapsed": false,
"too_large": false,
"new_file": true,
"renamed_file": false,
"deleted_file": false,
"generated_file": false
}]
}
머지 리퀘스트에 예상 소요 시간 설정#
이 머지 리퀘스트의 예상 작업 시간을 설정합니다.
POST /projects/:id/merge_requests/:merge_request_iid/time_estimate
| 속성 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로입니다. |
| merge_request_iid | integer | 예 | 머지 리퀘스트의 내부 ID입니다. |
| duration | string | 예 | 3h30m과 같은 사람이 읽을 수 있는 형식의 소요 시간입니다. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/time_estimate?duration=3h30m"
응답 예시:
{
"human_time_estimate": "3h 30m",
"human_total_time_spent": null,
"time_estimate": 12600,
"total_time_spent": 0
}
머지 리퀘스트의 예상 시간 초기화#
이 머지 리퀘스트의 예상 시간을 0초로 초기화합니다.
POST /projects/:id/merge_requests/:merge_request_iid/reset_time_estimate
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of a project’s merge request. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_time_estimate"
응답 예시:
{
"human_time_estimate": null,
"human_total_time_spent": null,
"time_estimate": 0,
"total_time_spent": 0
}
머지 리퀘스트에 소요 시간 추가#
이 머지 리퀘스트에 소요 시간을 추가합니다.
POST /projects/:id/merge_requests/:merge_request_iid/add_spent_time
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of the merge request. |
| duration | string | Yes | The duration in human format, such as 3h30m |
| summary | string | No | A summary of how the time was spent. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/add_spent_time?duration=1h"
응답 예시:
{
"human_time_estimate": null,
"human_total_time_spent": "1h",
"time_estimate": 0,
"total_time_spent": 3600
}
머지 리퀘스트의 소요 시간 초기화#
이 머지 리퀘스트의 총 소요 시간을 0초로 초기화합니다.
POST /projects/:id/merge_requests/:merge_request_iid/reset_spent_time
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | integer or string | Yes | The ID or URL-encoded path of the project. |
| merge_request_iid | integer | Yes | The internal ID of a project’s merge request. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_spent_time"
응답 예시:
{
"human_time_estimate": null,
"human_total_time_spent": null,
"time_estimate": 0,
"total_time_spent": 0
}
시간 추적 통계 조회#
머지 리퀘스트의 시간 추적 통계를 조회합니다.
GET /projects/:id/merge_requests/:merge_request_iid/time_stats
| 속성 | 유형 | 필수 여부 | 설명 |
|---|---|---|---|
| id | integer 또는 string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
| merge_request_iid | integer | 예 | 머지 리퀘스트의 내부 ID. |
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/5/merge_requests/93/time_stats"
응답 예시:
{
"human_time_estimate": "2h",
"human_total_time_spent": "1h",
"time_estimate": 7200,
"total_time_spent": 3600
}
승인#
승인에 대한 자세한 내용은 머지 리퀘스트 승인을 참조하세요.
머지 리퀘스트 상태 이벤트 목록#
어떤 상태가 설정되었는지, 누가 설정했는지, 언제 발생했는지 추적하려면 리소스 상태 이벤트 API를 참조하세요.
문제 해결#
새 머지 리퀘스트의 빈 API 필드#
머지 리퀘스트를 생성하면 diff_refs와 changes_count 필드가
처음에는 비어 있습니다. 이 필드들은 머지 리퀘스트를 생성한 후 비동기적으로 채워집니다.
자세한 내용은 이슈 386562와
GitLab 포럼의 관련 논의를 참조하세요.