토론 API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

토론은 다음에 연결됩니다:

  • 스니펫
  • 이슈
  • 에픽
  • 병합 요청
  • 커밋

이는 댓글, 스레드, 및 시스템 노트를 포함합니다.
시스템 노트는 객체에 대한 변경 사항에 대한 노트입니다(예: 마일스톤이 변경될 때).

라벨 노트는 이 API의 일부가 아니며, 리소스 라벨 이벤트에 별도의 이벤트로 기록됩니다.

API에서 노트 유형 이해하기

모든 토론 유형이 API에서 동일하게 사용할 수 있는 것은 아닙니다:

  • 노트: 이슈, 병합 요청, 커밋, 또는 스니펫의 _루트_에 남긴 댓글입니다.
  • 토론: 이슈, 병합 요청, 커밋 또는 스니펫의 DiscussionNotes의 집합, 종종 _스레드_라고 불립니다.
  • DiscussionNote: 이슈, 병합 요청, 커밋, 또는 스니펫에 대한 토론의 개별 항목입니다. 이는 노트 API의 일부로 반환되지 않습니다.
    이벤트 API에서 사용할 수 없습니다.

토론 페이지네이션

기본적으로 GET 요청은 API 결과가 페이지로 나뉘어 있기 때문에 한 번에 20개의 결과를 반환합니다.

페이지네이션에 대해 더 알아보세요.

이슈

프로젝트 이슈 토론 항목 목록

단일 이슈에 대한 모든 토론 항목 목록을 가져옵니다.

GET /projects/:id/issues/:issue_iid/discussions
속성 유형 필수 설명
id integer/string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid integer 이슈의 IID입니다.
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "토론 텍스트",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "project_id": 5,
        "noteable_iid": null
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "토론에 대한 답글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "단일 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>"\
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions"

단일 이슈 토론 항목 가져오기

특정 프로젝트 이슈에 대한 단일 토론 항목을 반환합니다.

GET /projects/:id/issues/:issue_iid/discussions/:discussion_id

매개변수:

속성 유형 필요 여부 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid 정수 이슈의 IID입니다.
discussion_id 정수 토론 항목의 ID입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>"

새 이슈 스레드 생성

단일 프로젝트 이슈에 새 스레드를 생성합니다. 노트를 생성하는 것과 비슷하지만, 나중에 다른 댓글(답글)을 추가할 수 있습니다.

POST /projects/:id/issues/:issue_iid/discussions

매개변수:

속성 유형 필요 여부 설명
body 문자열 스레드의 내용입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid 정수 이슈의 IID입니다.
created_at 문자열 아니요 날짜 및 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리 권한 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions?body=comment"

기존 이슈 스레드에 노트 추가

스레드에 새 노트를 추가합니다. 이는 단일 댓글로부터 스레드를 생성할 수도 있습니다.

경고: 노트는 시스템 노트와 같은 댓글 이외의 다른 항목에도 추가될 수 있으며, 스레드가 됩니다.

POST /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes

매개변수:

속성 유형 필요 여부 설명
body 문자열 노트 또는 답글의 내용입니다.
discussion_id 정수 스레드의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid 정수 이슈의 IID입니다.
note_id 정수 스레드 노트의 ID입니다.
created_at 문자열 아니요 날짜 및 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리 권한 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes?body=comment"

기존 이슈 스레드 노트 수정

기존 이슈의 스레드 노트를 수정합니다.

PUT /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
body string 노트 또는 답장의 내용입니다.
discussion_id integer 스레드의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid integer 이슈의 IID입니다.
note_id integer 스레드 노트의 ID입니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes/1108?body=comment"

이슈 스레드 노트 삭제

기존 이슈의 스레드 노트를 삭제합니다.

DELETE /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
discussion_id integer 논의의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
issue_iid integer 이슈의 IID입니다.
note_id integer 논의 노트의 ID입니다.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/636"

스니펫

프로젝트 스니펫 논의 항목 목록

단일 스니펫의 모든 논의 항목 목록을 가져옵니다.

GET /projects/:id/snippets/:snippet_id/discussions
속성 유형 필수 설명
id integer/string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
snippet_id integer 스니펫의 ID입니다.
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "논의 텍스트",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Snippet",
        "project_id": 5,
        "noteable_iid": null
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "논의에 대한 답변",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Snippet",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "단일 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Snippet",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions"

단일 스니펫 토론 항목 가져오기

특정 프로젝트 스니펫에 대한 단일 토론 항목을 반환합니다.

GET /projects/:id/snippets/:snippet_id/discussions/:discussion_id

매개변수:

속성 유형 필수 설명
discussion_id integer 토론 항목의 ID입니다.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
snippet_id integer 스니펫의 ID입니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>"

새 스니펫 스레드 만들기

단일 프로젝트 스니펫에 대해 새 스레드를 만듭니다. 노트를 만드는 것과 비슷하지만, 나중에 다른 댓글(응답)을 추가할 수 있습니다.

POST /projects/:id/snippets/:snippet_id/discussions

매개변수:

속성 유형 필수 설명
body string 토론 내용입니다.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
snippet_id integer 스니펫의 ID입니다.
created_at string 아니오 날짜 시간 문자열, ISO 8601 포맷으로, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>"\
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions?body=comment"

기존 스니펫 스레드에 노트 추가

스레드에 새 노트를 추가합니다.

POST /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes

매개변수:

속성 유형 필수 설명
body string 노트 또는 응답의 내용입니다.
discussion_id integer 스레드의 ID입니다.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
note_id integer 스레드 노트의 ID입니다.
snippet_id integer 스니펫의 ID입니다.
created_at string 아니오 날짜 시간 문자열, ISO 8601 포맷으로, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes?body=comment"

기존 스니펫 스레드 노트 수정

스니펫의 기존 스레드 노트를 수정합니다.

PUT /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
body string 노트 또는 응답의 내용입니다.
discussion_id integer 스레드의 ID입니다.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
note_id integer 스레드 노트의 ID입니다.
snippet_id integer 스니펫의 ID입니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/1108?body=comment"

스니펫 스레드 노트 삭제

기존 스니펫의 스레드 노트를 삭제합니다.

DELETE /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
discussion_id 정수 토론의 ID.
id 정수 또는 문자열 프로젝트의 ID 또는 URL-인코딩된 경로.
note_id 정수 토론 노트의 ID.
snippet_id 정수 스니펫의 ID.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/636"

에픽

Tier: Ultimate

Offering: GitLab.com, Self-managed, GitLab Dedicated

caution

에픽 REST API는 사용 중단되었습니다

GitLab 17.0에서 사용 중단되었으며 API v5에서 제거될 예정입니다.

GitLab 17.4 이상에서 관리자가 에픽의 새로운 모양을 사용하도록 설정한 경우,

작업 항목 API를 대신 사용하세요.

이 변경 사항은 주요 변경 사항입니다.

그룹 에픽 토론 항목 목록

단일 에픽에 대한 모든 토론 항목 목록을 가져옵니다.

GET /groups/:id/epics/:epic_id/discussions
속성 유형 필수 설명
epic_id 정수 에픽의 ID.
id 정수 또는 문자열 그룹의 ID 또는 URL-인코딩된 경로.
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "토론 텍스트",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Epic",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "토론에 대한 답글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Epic",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "단일 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Epic",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>"\
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions"

단일 에픽 논의 항목 가져오기

특정 그룹 에픽에 대한 단일 논의 항목을 반환합니다.

GET /groups/:id/epics/:epic_id/discussions/:discussion_id

매개변수:

속성 유형 필수 설명
discussion_id 정수 논의 항목의 ID.
epic_id 정수 에픽의 ID.
id 정수 또는 문자열 그룹의 ID 또는 URL로 인코딩된 경로.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>"

새로운 에픽 스레드 만들기

단일 그룹 에픽에 대한 새로운 스레드를 생성합니다. 노트를 생성하는 것과 유사하지만, 나중에 다른 댓글(답글)을 추가할 수 있습니다.

POST /groups/:id/epics/:epic_id/discussions

매개변수:

속성 유형 필수 설명
body 문자열 스레드의 내용.
epic_id 정수 에픽의 ID.
id 정수 또는 문자열 그룹의 ID 또는 URL로 인코딩된 경로.
created_at 문자열 아니오 날짜 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리자가 아니면 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions?body=comment"

기존 에픽 스레드에 주석 추가

스레드에 새 주석을 추가합니다. 또한 이 단일 댓글로부터 스레드를 생성할 수 있습니다.

POST /groups/:id/epics/:epic_id/discussions/:discussion_id/notes

매개변수:

속성 유형 필수 설명
body 문자열 노트 또는 답글의 내용.
discussion_id 정수 스레드의 ID.
epic_id 정수 에픽의 ID.
id 정수 또는 문자열 그룹의 ID 또는 URL로 인코딩된 경로.
note_id 정수 스레드 노트의 ID.
created_at 문자열 아니오 날짜 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리자가 아니면 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes?body=comment"

기존 에픽 스레드 노트 수정

기존 에픽의 스레드 노트를 수정합니다.

PUT /groups/:id/epics/:epic_id/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
body 문자열 노트 또는 답글의 내용입니다.
discussion_id 정수 스레드의 ID입니다.
epic_id 정수 에픽의 ID입니다.
id 정수/문자열 그룹의 ID 또는 URL-인코딩 경로입니다.
note_id 정수 스레드 노트의 ID입니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes/1108?body=comment"

에픽 스레드 노트 삭제

기존 에픽의 스레드 노트를 삭제합니다.

DELETE /groups/:id/epics/:epic_id/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
discussion_id 정수 스레드의 ID입니다.
epic_id 정수 에픽의 ID입니다.
id 정수 또는 문자열 그룹의 ID 또는 URL-인코딩 경로입니다.
note_id 정수 스레드 노트의 ID입니다.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/636"

병합 요청

프로젝트 병합 요청 토론 항목 목록

단일 병합 요청의 모든 토론 항목 목록을 가져옵니다.

GET /projects/:id/merge_requests/:merge_request_iid/discussions
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL-인코딩 경로입니다.
merge_request_iid 정수 병합 요청의 IID입니다.
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "토론 텍스트",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "MergeRequest",
        "project_id": 5,
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null,
        "resolved_at": null
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "토론에 대한 답변",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "MergeRequest",
        "project_id": 5,
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "단일 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "MergeRequest",
        "project_id": 5,
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null
      }
    ]
  }
]

Diff 댓글은 위치 정보도 포함합니다:

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": "DiffNote",
        "body": "diff 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "MergeRequest",
        "project_id": 5,
        "noteable_iid": null,
        "commit_id": "4803c71e6b1833ca72b8b26ef2ecd5adc8a38031",
        "position": {
          "base_sha": "b5d6e7b1613fca24d250fa8e5bc7bcc3dd6002ef",
          "start_sha": "7c9c2ead8a320fb7ba0b4e234bd9529a2614e306",
          "head_sha": "4803c71e6b1833ca72b8b26ef2ecd5adc8a38031",
          "old_path": "package.json",
          "new_path": "package.json",
          "position_type": "text",
          "old_line": 27,
          "new_line": 27,
          "line_range": {
            "start": {
              "line_code": "588440f66559714280628a4f9799f0c4eb880a4a_10_10",
              "type": "new"
            },
            "end": {
              "line_code": "588440f66559714280628a4f9799f0c4eb880a4a_11_11",
              "type": "old"
            }
          }
        },
        "resolved": false,
        "resolvable": true,
        "resolved_by": null
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"

단일 병합 요청 토론 항목 가져오기

특정 프로젝트 병합 요청에 대한 단일 토론 항목을 반환합니다.

GET /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id

매개변수:

속성 유형 필수 설명
discussion_id string 토론 항목의 ID입니다.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid integer 병합 요청의 IID입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>"

새 병합 요청 스레드 생성

단일 프로젝트 병합 요청에 대한 새 스레드를 생성합니다. 노트를 생성하는 것과 유사하지만 나중에 다른 댓글(답글)을 추가할 수 있습니다. 다른 접근 방식은 Commits API의 커밋에 댓글 게시하기와 Notes API의 새 병합 요청 노트 생성하기를 참고하세요.

POST /projects/:id/merge_requests/:merge_request_iid/discussions

모든 댓글에 대한 매개변수:

속성 유형 필수 설명
body string 스레드의 내용입니다.
id integer/string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid integer 병합 요청의 IID입니다.
position[base_sha] string 예 (if position* is supplied) 소스 브랜치의 기본 커밋 SHA입니다.
position[head_sha] string 예 (if position* is supplied) 이 병합 요청의 HEAD를 참조하는 SHA입니다.
position[start_sha] string 예 (if position* is supplied) 대상 브랜치의 커밋을 참조하는 SHA입니다.
position[new_path] string 예 (if the position type is text) 변경 후 파일 경로입니다.
position[old_path] string 예 (if the position type is text) 변경 전 파일 경로입니다.
position[position_type] string 예 (if position* is supplied) 포지션 참조의 유형입니다. 허용 값: text, image, 또는 file. file은 GitLab 16.4에서 도입됨.
commit_id string 아니 이 스레드를 시작하는 커밋을 참조하는 SHA입니다.
created_at string 아니 날짜 시간 문자열로, ISO 8601 형식이며, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
position hash 아니 diff 노트를 생성할 때의 포지션입니다.
position[new_line] integer 아니 text diff 노트의 경우 변경 후의 행 번호입니다.
position[old_line] integer 아니 text diff 노트의 경우 변경 전의 행 번호입니다.
position[line_range] hash 아니 다중 행 diff 노트의 행 범위입니다.
position[width] integer 아니 image diff 노트의 경우 이미지의 너비입니다.
position[height] integer 아니 image diff 노트의 경우 이미지의 높이입니다.
position[x] float 아니 image diff 노트의 경우 X 좌표입니다.
position[y] float 아니 image diff 노트의 경우 Y 좌표입니다.

개요 페이지에 새 스레드 생성

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment"

병합 요청 diff에서 새 스레드 생성

  • position[old_path]position[new_path]는 필수이며 변경 전후의 파일 경로를 참조해야 합니다.

  • 추가된 행(병합 요청 diff에서 초록색으로 강조 표시됨)에 대한 스레드를 생성하려면 position[new_line]을 사용하고 position[old_line]은 포함하지 마세요.

  • 제거된 행(병합 요청 diff에서 빨간색으로 강조 표시됨)에 대한 스레드를 생성하려면 position[old_line]을 사용하고 position[new_line]은 포함하지 마세요.

  • 변경되지 않은 행에 대한 스레드를 생성하려면 해당 행에 대해 position[new_line]position[old_line]을 모두 포함해야 합니다. 이전에 파일에서 변경 사항으로 인해 행 번호가 변경된 경우 이 위치는 다를 수 있습니다. 수정 사항에 대한 논의는 이슈 32516을 참조하세요.

  • 잘못된 base, head, start, 또는 SHA 매개변수를 지정하면 이슈 #296829에 설명된 버그에 직면할 수 있습니다.

새 스레드를 생성하려면:

  1. 최신 병합 요청 버전 가져오기:

    curl --header "PRIVATE-TOKEN: <your_access_token>" \
      "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/versions"
    
  2. 응답 배열에서 첫 번째로 나열된 최신 버전의 세부 정보를 확인하세요.

    [
      {
        "id": 164560414,
        "head_commit_sha": "f9ce7e16e56c162edbc9e480108041cf6b0291fe",
        "base_commit_sha": "5e6dffa282c5129aa67cd227a0429be21bfdaf80",
        "start_commit_sha": "5e6dffa282c5129aa67cd227a0429be21bfdaf80",
        "created_at": "2021-03-30T09:18:27.351Z",
        "merge_request_id": 93958054,
        "state": "collected",
        "real_size": "2"
      },
      "이전 버전은 여기에 있습니다"
    ]
    
  3. 새 diff 스레드를 생성하세요. 이 예제는 추가된 행에 스레드를 생성합니다:

    curl --request POST --header "PRIVATE-TOKEN: <your_access_token>"\
      --form 'position[position_type]=text'\
      --form 'position[base_sha]=<use base_commit_sha from the versions response>'\
      --form 'position[head_sha]=<use head_commit_sha from the versions response>'\
      --form 'position[start_sha]=<use start_commit_sha from the versions response>'\
      --form 'position[new_path]=file.js'\
      --form 'position[old_path]=file.js'\
      --form 'position[new_line]=18'\
      --form 'body=test comment body'\
      "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"
    

여러 줄 주석을 위한 매개변수

여러 줄 주석 전용 매개변수:

속성 유형 필수 설명
position[line_range][end][line_code] 문자열 끝 줄에 대한 라인 코드입니다.
position[line_range][end][type] 문자열 이 커밋에 의해 추가된 줄은 new를 사용하고, 그렇지 않으면 old입니다.
position[line_range][start][line_code] 문자열 시작 줄에 대한 라인 코드입니다.
position[line_range][start][type] 문자열 이 커밋에 의해 추가된 줄은 new를 사용하고, 그렇지 않으면 old입니다.
position[line_range][end] 해시 아니오 여러 줄 메모 종료 줄입니다.
position[line_range][start] 해시 아니오 여러 줄 메모 시작 줄입니다.

라인 코드

라인 코드는 <SHA>_<old>_<new> 형식입니다. 예: adc83b19e793491b1c6ea0fd8b46cd9f32e292fc_5_5

  • <SHA>는 파일 이름의 SHA1 해시입니다.
  • <old>는 변경 전의 줄 번호입니다.
  • <new>는 변경 후의 줄 번호입니다.

예를 들어, 커밋(<COMMIT_ID>)이 README에서 463번 줄을 삭제하면, old 파일에서 463번 줄을 참조하여 삭제에 대해 주석을 달 수 있습니다:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=이 불필요한 줄을 제거한 것이 정말 영리합니다!" \
  --form "path=README" --form "line=463" --form "line_type=old" \
  "https://gitlab.com/api/v4/projects/47/repository/commits/<COMMIT_ID>/comments"

커밋(<COMMIT_ID>)이 hello.rb에 157번 줄을 추가하면, new 파일에서 157번 줄을 참조하여 추가에 대해 주석을 달 수 있습니다:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=이건 정말 훌륭합니다!" --form "path=hello.rb" \
  --form "line=157" --form "line_type=new" \
  "https://gitlab.com/api/v4/projects/47/repository/commits/<COMMIT_ID>/comments"

병합 요청 스레드 해결

병합 요청에서 토론의 스레드를 해결하거나 해결 취소합니다.

전제 조건:

  • 적어도 개발자 역할을 가지고 있거나 검토 중인 변경의 작성자여야 합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id

매개변수:

속성 유형 필수 설명
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
discussion_id 문자열 스레드의 ID입니다.
merge_request_iid 정수 병합 요청의 IID입니다.
resolved 부울 토론을 해결할지 또는 해결 취소할지입니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>?resolved=true"

기존 병합 요청 스레드에 메모 추가

스레드에 새 메모를 추가합니다. 이것은 단일 댓글에서 스레드를 생성할 수도 있습니다.

POST /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes

매개변수:

속성 유형 필수 설명
body string 메모 또는 답변의 내용입니다.
id integer/string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
discussion_id string 스레드의 ID입니다.
merge_request_iid integer 병합 요청의 IID입니다.
note_id integer 스레드 메모의 ID입니다.
created_at string 아니오 날짜 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>/notes?body=comment"

기존 병합 요청 스레드 메모 수정

병합 요청의 기존 스레드 메모를 수정하거나 해결합니다.

PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
discussion_id string 스레드의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
merge_request_iid integer 병합 요청의 IID입니다.
note_id integer 스레드 메모의 ID입니다.
body string 아니오 메모 또는 답변의 내용입니다. body 또는 resolved 중 정확히 하나가 설정되어야 합니다.
resolved boolean 아니오 메모를 해결하거나 해결 해제합니다. body 또는 resolved 중 정확히 하나가 설정되어야 합니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>/notes/1108?body=comment"

메모 해결하기:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>/notes/1108?resolved=true"

병합 요청 스레드 메모 삭제

병합 요청의 기존 스레드 메모를 삭제합니다.

DELETE /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes/:note_id

매개변수:

속성 유형 필수 설명
discussion_id string 스레드의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
merge_request_iid integer 병합 요청의 IID입니다.
note_id integer 스레드 메모의 ID입니다.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/636"

커밋

프로젝트 커밋 토론 항목 목록

단일 커밋에 대한 모든 토론 항목 목록을 가져옵니다.

GET /projects/:id/repository/commits/:commit_id/discussions
속성 유형 필수 설명
commit_id 문자열 커밋의 SHA입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL로 인코딩된 경로입니다.
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "토론 텍스트",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "토론에 대한 답변",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "단일 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "project_id": 5,
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  }
]

Diff 댓글에는 위치 정보도 포함됩니다:

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": "DiffNote",
        "body": "diff 댓글",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "project_id": 5,
        "noteable_iid": null,
        "position": {
          "base_sha": "b5d6e7b1613fca24d250fa8e5bc7bcc3dd6002ef",
          "start_sha": "7c9c2ead8a320fb7ba0b4e234bd9529a2614e306",
          "head_sha": "4803c71e6b1833ca72b8b26ef2ecd5adc8a38031",
          "old_path": "package.json",
          "new_path": "package.json",
          "position_type": "text",
          "old_line": 27,
          "new_line": 27
        },
        "resolvable": false
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions"

단일 커밋 토론 항목 가져오기

특정 프로젝트 커밋에 대한 단일 토론 항목을 반환합니다.

GET /projects/:id/repository/commits/:commit_id/discussions/:discussion_id

매개변수:

속성 유형 필수 설명
commit_id string 커밋의 SHA입니다.
discussion_id string 토론 항목의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>"

새 커밋 스레드 생성

단일 프로젝트 커밋에 대한 새 스레드를 생성합니다. 노트를 생성하는 것과 비슷하지만 나중에 다른 댓글(답글)을 추가할 수 있습니다.

POST /projects/:id/repository/commits/:commit_id/discussions

매개변수:

속성 유형 필수 설명
body string 스레드의 내용입니다.
commit_id string 커밋의 SHA입니다.
id integer/string 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
position[base_sha] string 예(position*가 공급된 경우만) 부모 커밋의 SHA입니다.
position[head_sha] string 예(position*가 공급된 경우만) 이 커밋의 SHA입니다. commit_id와 동일합니다.
position[start_sha] string 예(position*가 공급된 경우만) 부모 커밋의 SHA입니다.
position[position_type] string 예(position*가 공급된 경우만) 위치 참조의 유형입니다. 허용 값: text, image, 또는 file. file은 GitLab 16.4에서 도입됨.
created_at string 아니오 날짜 시간 문자열, ISO 8601 형식, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
position 해시 아니오 diff 노트를 생성할 때의 위치입니다.
position[new_path] string 아니오 변경 후 파일 경로입니다.
position[new_line] integer 아니오 변경 후 줄 번호입니다.
position[old_path] string 아니오 변경 전 파일 경로입니다.
position[old_line] integer 아니오 변경 전 줄 번호입니다.
position[height] integer 아니오 image diff 노트의 이미지 높이입니다.
position[width] integer 아니오 image diff 노트의 이미지 너비입니다.
position[x] integer 아니오 image diff 노트의 X 좌표입니다.
position[y] integer 아니오 image diff 노트의 Y 좌표입니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions?body=comment"

API 요청을 생성하는 규칙은 병합 요청 diff에서 새 스레드를 생성할 때와 동일합니다. 예외사항:

  • base_sha
  • head_sha
  • start_sha

기존 커밋 쓰레드에 메모 추가

쓰레드에 새로운 메모를 추가합니다.

POST /projects/:id/repository/commits/:commit_id/discussions/:discussion_id/notes

파라미터:

속성 타입 필수 설명
body string 메모 또는 답장의 내용입니다.
commit_id string 커밋의 SHA입니다.
discussion_id string 쓰레드의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
note_id integer 쓰레드 메모의 ID입니다.
created_at string 아니오 날짜 및 시간 문자열, ISO 8601 형식으로, 예: 2016-03-11T03:45:40Z. 관리자 권한 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes?body=comment"

기존 커밋 쓰레드 메모 수정

커밋의 기존 쓰레드 메모를 수정하거나 해결합니다.

PUT /projects/:id/repository/commits/:commit_id/discussions/:discussion_id/notes/:note_id

파라미터:

속성 타입 필수 설명
commit_id string 커밋의 SHA입니다.
discussion_id string 쓰레드의 ID입니다.
id integer or string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
note_id integer 쓰레드 메모의 ID입니다.
body string 아니오 메모의 내용입니다.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes/1108?body=comment"

메모 해결하기:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes/1108?resolved=true"

커밋 쓰레드 메모 삭제

기존 커밋의 쓰레드 메모를 삭제합니다.

DELETE /projects/:id/repository/commits/:commit_id/discussions/:discussion_id/notes/:note_id

파라미터:

속성 타입 필수 설명
id integer or string 프로젝트의 ID 또는 URL 인코딩 경로입니다.
commit_id string 커밋의 SHA입니다.
discussion_id string 쓰레드의 ID입니다.
note_id integer 쓰레드 메모의 ID입니다.
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes/636"