InfoGrab DocsInfoGrab Docs

Discussions API

요약

이 API를 사용하여 토론을 관리하세요. 라벨 노트를 관리하려면 리소스 라벨 이벤트 API를 사용하세요. 모든 토론 유형이 API에서 동일하게 사용 가능한 것은 아닙니다: Note: 이슈, 머지 리퀘스트, 커밋 또는 스니펫의 루트에 남긴 댓글.

이 API를 사용하여 토론을 관리하세요. 댓글, 스레드, 그리고 객체 변경에 대한 시스템 노트(예: 마일스톤 변경 시)가 포함됩니다.

라벨 노트를 관리하려면 리소스 라벨 이벤트 API를 사용하세요.

API에서 노트 유형 이해하기#

모든 토론 유형이 API에서 동일하게 사용 가능한 것은 아닙니다:

  • Note: 이슈, 머지 리퀘스트, 커밋 또는 스니펫의 루트에 남긴 댓글.

  • Discussion: 이슈, 머지 리퀘스트, 커밋 또는 스니펫에서 DiscussionNote의 모음으로 흔히 스레드라고 불립니다.

  • DiscussionNote: 이슈, 머지 리퀘스트, 커밋 또는 스니펫에서 토론의 개별 항목. DiscussionNote 유형의 항목은 Note API의 일부로 반환되지 않습니다. 이벤트 API에서는 사용할 수 없습니다.

토론 페이지네이션#

기본적으로 API 결과가 페이지네이션되어 있으므로 GET 요청은 한 번에 20개의 결과를 반환합니다.

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

이슈#

모든 이슈 토론 항목 나열#

프로젝트의 지정된 이슈에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
id string 토론의 ID.
individual_note boolean true이면 개별 노트 또는 토론의 일부.
notes array 토론의 노트 객체 배열.
notes[].id integer 노트의 ID.
notes[].type string 노트 유형 (DiscussionNote 또는 null).
notes[].body string 노트의 내용.
notes[].author object 노트의 작성자.
notes[].created_at string 노트 생성 시각 (ISO 8601 형식).
notes[].updated_at string 노트 마지막 업데이트 시각 (ISO 8601 형식).
notes[].system boolean true이면 시스템 노트.
notes[].noteable_id integer noteable 객체의 ID.
notes[].noteable_type string noteable 객체의 유형.
notes[].project_id integer 프로젝트의 ID.
notes[].resolvable boolean true이면 노트를 해결할 수 있음.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

이슈 토론 항목 조회#

프로젝트 이슈에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.

성공하면 200 OK이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>"

이슈 스레드 생성#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 스레드의 내용.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

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

이슈 스레드에 노트 추가#

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

노트는 시스템 노트에 추가할 수 없습니다. 시도할 경우 400 Bad Request 오류가 반환됩니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

이슈 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
note_id integer 토론 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes/<note_id>"

스니펫#

모든 스니펫 토론 항목 나열#

프로젝트의 지정된 스니펫에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id integer 스니펫의 ID.

성공하면 200 OKnoteable_typeSnippet으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

스니펫 토론 항목 조회#

프로젝트 스니펫에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id integer 스니펫의 ID.

성공하면 200 OK스니펫 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 인코딩된 경로.
snippet_id integer 스니펫의 ID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

스니펫 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 토론 노트의 ID.
snippet_id integer 스니펫의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/<note_id>"

에픽#

Tier: Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

에픽 REST API는 GitLab 17.0에서 폐지되었으며 API v5에서 제거될 예정입니다. 이 변경은 브레이킹 체인지입니다.

대신 Work Items API를 사용하세요:

  • GitLab 17.4 ~ 18.0: 에픽의 새로운 외관이 활성화된 경우 필수입니다.

  • GitLab 18.1 이상: 모든 설치 환경에서 필수입니다.

자세한 내용은 API 마이그레이션 가이드를 참조하세요.

모든 에픽 토론 항목 나열#

단일 에픽에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.

성공하면 200 OKnoteable_typeEpic으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

에픽 토론 항목 조회#

그룹 에픽에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.

성공하면 200 OK에픽 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>"

에픽 스레드 생성#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 스레드의 내용.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

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

에픽 스레드에 노트 추가#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

에픽 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes/<note_id>"

머지 리퀘스트#

모든 머지 리퀘스트 토론 항목 나열#

지정된 머지 리퀘스트에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
id string 토론의 ID.
individual_note boolean true이면 개별 노트 또는 토론의 일부.
notes array 토론의 노트 객체 배열.
notes[].id integer 노트의 ID.
notes[].type string 노트 유형 (DiscussionNote, DiffNote 또는 null).
notes[].body string 노트의 내용.
notes[].author object 노트의 작성자.
notes[].created_at string 노트 생성 시각 (ISO 8601 형식).
notes[].updated_at string 노트 마지막 업데이트 시각 (ISO 8601 형식).
notes[].system boolean true이면 시스템 노트.
notes[].noteable_id integer noteable 객체의 ID.
notes[].noteable_type string noteable 객체의 유형.
notes[].project_id integer 프로젝트의 ID.
notes[].resolved boolean true이면 노트가 해결됨 (머지 리퀘스트 전용).
notes[].resolvable boolean true이면 노트를 해결할 수 있음.
notes[].resolved_by object 노트를 해결한 사용자.
notes[].resolved_at string 노트 해결 시각 (ISO 8601 형식).
notes[].position object diff 노트의 위치 정보.
notes[].suggestions array 노트에 대한 제안 객체 배열.

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

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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 comment",
        "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",
              "old_line": null,
              "new_line": 10
            },
            "end": {
              "line_code": "588440f66559714280628a4f9799f0c4eb880a4a_11_11",
              "type": "old",
              "old_line": 11,
              "new_line": 11
            }
          }
        },
        "resolved": false,
        "resolvable": true,
        "resolved_by": null,
        "suggestions": [
          {
            "id": 1,
            "from_line": 27,
            "to_line": 27,
            "appliable": true,
            "applied": false,
            "from_content": "x",
            "to_content": "b"
          }
        ]
      }
    ]
  }
]

머지 리퀘스트 토론 항목 조회#

프로젝트 머지 리퀘스트에 대한 지정된 토론 항목을 조회합니다.

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.

성공하면 200 OK머지 리퀘스트 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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.
commit_id string 아니요 이 토론을 시작할 커밋을 참조하는 SHA.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.
position hash 아니요 diff 노트 생성 시 위치.
position[base_sha] string 예 (position*이 제공된 경우) 소스 브랜치의 베이스 커밋 SHA.
position[head_sha] string 예 (position*이 제공된 경우) 이 머지 리퀘스트의 HEAD를 참조하는 SHA.
position[start_sha] string 예 (position*이 제공된 경우) 타깃 브랜치의 커밋을 참조하는 SHA.
position[position_type] string 예 (position*이 제공된 경우) 위치 참조의 유형. 허용 값: text, image, 또는 file. file은 GitLab 16.4에서 도입됨.
position[new_path] string 예 (position type이 text인 경우) 변경 후 파일 경로.
position[old_path] string 예 (position type이 text인 경우) 변경 전 파일 경로.
position[new_line] integer 아니요 텍스트 diff 노트의 경우, 변경 후 줄 번호.
position[old_line] integer 아니요 텍스트 diff 노트의 경우, 변경 전 줄 번호.
position[line_range] hash 아니요 멀티라인 diff 노트의 줄 범위.
position[width] integer 아니요 이미지 diff 노트의 경우, 이미지 너비.
position[height] integer 아니요 이미지 diff 노트의 경우, 이미지 높이.
position[x] float 아니요 이미지 diff 노트의 경우, X 좌표.
position[y] float 아니요 이미지 diff 노트의 경우, Y 좌표.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

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

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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에 설명된 버그가 발생할 수 있습니다.

새 스레드를 생성하려면:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/versions"
  • 응답 배열에서 첫 번째로 나열된 최신 버전의 세부 정보를 확인합니다.
[
  {
    "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"
  },
  "previous versions are here"
]
  • 새 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' \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"

멀티라인 댓글 파라미터#

멀티라인 댓글에만 지원되는 속성:

속성 유형 필수 여부 설명
position[line_range][end][line_code] string 종료 줄의 라인 코드.
position[line_range][end][type] string 이 커밋으로 추가된 줄이면 new, 그 외에는 old 사용.
position[line_range][end][old_line] integer 아니요 종료 줄의 이전 줄 번호.
position[line_range][end][new_line] integer 아니요 종료 줄의 새 줄 번호.
position[line_range][start][line_code] string 시작 줄의 라인 코드.
position[line_range][start][type] string 이 커밋으로 추가된 줄이면 new, 그 외에는 old 사용.
position[line_range][start][old_line] integer 아니요 시작 줄의 이전 줄 번호.
position[line_range][start][new_line] integer 아니요 시작 줄의 새 줄 번호.
position[line_range][end] hash 아니요 멀티라인 노트 종료 줄.
position[line_range][start] hash 아니요 멀티라인 노트 시작 줄.

line_range 속성 내의 old_linenew_line 파라미터는 멀티라인 댓글의 범위를 표시합니다. 예를 들어 "Comment on lines +296 to +297"과 같은 형식입니다.

라인 코드#

라인 코드는 _<old>_<new> 형식으로, 예를 들면 adc83b19e793491b1c6ea0fd8b46cd9f32e292fc_5_5와 같습니다.

  • 는 파일명의 SHA1 해시입니다.

  • <old>는 변경 전 줄 번호입니다.

  • <new>는 변경 후 줄 번호입니다.

예를 들어, 커밋()이 README의 463번째 줄을 삭제하는 경우, 이전 파일의 463번 줄을 참조하여 삭제에 댓글을 달 수 있습니다:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=Very clever to remove this unnecessary line!" \
  --form "path=README" \
  --form "line=463" \
  --form "line_type=old" \
  --url "https://gitlab.com/api/v4/projects/47/repository/commits//comments"

커밋()이 hello.rb의 157번째 줄을 추가하는 경우, 새 파일의 157번 줄을 참조하여 추가에 댓글을 달 수 있습니다:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=This is brilliant!" \
  --form "path=hello.rb" \
  --form "line=157" \
  --form "line_type=new" \
  --url "https://gitlab.com/api/v4/projects/47/repository/commits//comments"

머지 리퀘스트 스레드 해결#

머지 리퀘스트의 토론 스레드를 해결하거나 다시 열기합니다.

전제 조건:

  • Developer, Maintainer, 또는 Owner 권한이 있거나 검토 중인 변경의 작성자여야 합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
resolved boolean true이면 토론을 해결하거나 다시 열기.

성공하면 200 OK와 업데이트된 토론 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 노트 또는 답글의 내용.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
note_id integer 스레드 노트의 ID.
body string 아니요 노트 또는 답글의 내용. body 또는 resolved 중 정확히 하나를 설정해야 합니다.
resolved boolean 아니요 노트를 해결하거나 다시 열기. body 또는 resolved 중 정확히 하나를 설정해야 합니다.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

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

노트 해결:

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

머지 리퀘스트 스레드 노트 삭제#

머지 리퀘스트의 기존 스레드 노트를 삭제합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>/notes/<note_id>"

커밋#

모든 커밋 토론 항목 나열#

지정된 커밋에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.

성공하면 200 OKnoteable_typeCommit으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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 comment",
        "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
      }
    ]
  }
]

커밋 토론 항목 조회#

프로젝트 커밋에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
discussion_id string 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.

성공하면 200 OK커밋 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.
position hash 아니요 diff 노트 생성 시 위치.
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에서 도입됨.
position[new_path] string 아니요 변경 후 파일 경로.
position[new_line] integer 아니요 변경 후 줄 번호.
position[old_path] string 아니요 변경 전 파일 경로.
position[old_line] integer 아니요 변경 전 줄 번호.
position[height] integer 아니요 이미지 diff 노트의 경우, 이미지 높이.
position[width] integer 아니요 이미지 diff 노트의 경우, 이미지 너비.
position[x] integer 아니요 이미지 diff 노트의 경우, X 좌표.
position[y] integer 아니요 이미지 diff 노트의 경우, Y 좌표.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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

지원되는 속성:

속성 유형 필수 여부 설명
body string 아니요 노트의 내용.
commit_id string 커밋의 SHA.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

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

노트 해결:

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

커밋 토론 노트 삭제#

커밋의 기존 토론 노트를 삭제합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes/<note_id>"

Discussions API

GitLab v19.1
Tier: Free, Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이 API를 사용하여 토론을 관리하세요. 라벨 노트를 관리하려면 리소스 라벨 이벤트 API를 사용하세요. 모든 토론 유형이 API에서 동일하게 사용 가능한 것은 아닙니다: Note: 이슈, 머지 리퀘스트, 커밋 또는 스니펫의 루트에 남긴 댓글.

이 API를 사용하여 토론을 관리하세요. 댓글, 스레드, 그리고 객체 변경에 대한 시스템 노트(예: 마일스톤 변경 시)가 포함됩니다.

라벨 노트를 관리하려면 리소스 라벨 이벤트 API를 사용하세요.

API에서 노트 유형 이해하기#

모든 토론 유형이 API에서 동일하게 사용 가능한 것은 아닙니다:

  • Note: 이슈, 머지 리퀘스트, 커밋 또는 스니펫의 루트에 남긴 댓글.

  • Discussion: 이슈, 머지 리퀘스트, 커밋 또는 스니펫에서 DiscussionNote의 모음으로 흔히 스레드라고 불립니다.

  • DiscussionNote: 이슈, 머지 리퀘스트, 커밋 또는 스니펫에서 토론의 개별 항목. DiscussionNote 유형의 항목은 Note API의 일부로 반환되지 않습니다. 이벤트 API에서는 사용할 수 없습니다.

토론 페이지네이션#

기본적으로 API 결과가 페이지네이션되어 있으므로 GET 요청은 한 번에 20개의 결과를 반환합니다.

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

이슈#

모든 이슈 토론 항목 나열#

프로젝트의 지정된 이슈에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
id string 토론의 ID.
individual_note boolean true이면 개별 노트 또는 토론의 일부.
notes array 토론의 노트 객체 배열.
notes[].id integer 노트의 ID.
notes[].type string 노트 유형 (DiscussionNote 또는 null).
notes[].body string 노트의 내용.
notes[].author object 노트의 작성자.
notes[].created_at string 노트 생성 시각 (ISO 8601 형식).
notes[].updated_at string 노트 마지막 업데이트 시각 (ISO 8601 형식).
notes[].system boolean true이면 시스템 노트.
notes[].noteable_id integer noteable 객체의 ID.
notes[].noteable_type string noteable 객체의 유형.
notes[].project_id integer 프로젝트의 ID.
notes[].resolvable boolean true이면 노트를 해결할 수 있음.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

이슈 토론 항목 조회#

프로젝트 이슈에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.

성공하면 200 OK이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>"

이슈 스레드 생성#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 스레드의 내용.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

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

이슈 스레드에 노트 추가#

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

노트는 시스템 노트에 추가할 수 없습니다. 시도할 경우 400 Bad Request 오류가 반환됩니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

이슈 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
issue_iid integer 이슈의 IID.
note_id integer 토론 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/<discussion_id>/notes/<note_id>"

스니펫#

모든 스니펫 토론 항목 나열#

프로젝트의 지정된 스니펫에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id integer 스니펫의 ID.

성공하면 200 OKnoteable_typeSnippet으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

스니펫 토론 항목 조회#

프로젝트 스니펫에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id integer 스니펫의 ID.

성공하면 200 OK스니펫 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 인코딩된 경로.
snippet_id integer 스니펫의 ID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

스니펫 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 토론 노트의 ID.
snippet_id integer 스니펫의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/<note_id>"

에픽#

Tier: Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

에픽 REST API는 GitLab 17.0에서 폐지되었으며 API v5에서 제거될 예정입니다. 이 변경은 브레이킹 체인지입니다.

대신 Work Items API를 사용하세요:

  • GitLab 17.4 ~ 18.0: 에픽의 새로운 외관이 활성화된 경우 필수입니다.

  • GitLab 18.1 이상: 모든 설치 환경에서 필수입니다.

자세한 내용은 API 마이그레이션 가이드를 참조하세요.

모든 에픽 토론 항목 나열#

단일 에픽에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.

성공하면 200 OKnoteable_typeEpic으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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
      }
    ]
  }
]

에픽 토론 항목 조회#

그룹 에픽에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 토론 항목의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.

성공하면 200 OK에픽 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>"

에픽 스레드 생성#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 스레드의 내용.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

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

에픽 스레드에 노트 추가#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
body string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 string 노트 또는 답글의 내용.
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes/<note_id>?body=comment"

에픽 스레드 노트 삭제#

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

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id integer 스레드의 ID.
epic_id integer 에픽의 ID.
id integer 또는 string 그룹의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>/notes/<note_id>"

머지 리퀘스트#

모든 머지 리퀘스트 토론 항목 나열#

지정된 머지 리퀘스트에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
id string 토론의 ID.
individual_note boolean true이면 개별 노트 또는 토론의 일부.
notes array 토론의 노트 객체 배열.
notes[].id integer 노트의 ID.
notes[].type string 노트 유형 (DiscussionNote, DiffNote 또는 null).
notes[].body string 노트의 내용.
notes[].author object 노트의 작성자.
notes[].created_at string 노트 생성 시각 (ISO 8601 형식).
notes[].updated_at string 노트 마지막 업데이트 시각 (ISO 8601 형식).
notes[].system boolean true이면 시스템 노트.
notes[].noteable_id integer noteable 객체의 ID.
notes[].noteable_type string noteable 객체의 유형.
notes[].project_id integer 프로젝트의 ID.
notes[].resolved boolean true이면 노트가 해결됨 (머지 리퀘스트 전용).
notes[].resolvable boolean true이면 노트를 해결할 수 있음.
notes[].resolved_by object 노트를 해결한 사용자.
notes[].resolved_at string 노트 해결 시각 (ISO 8601 형식).
notes[].position object diff 노트의 위치 정보.
notes[].suggestions array 노트에 대한 제안 객체 배열.

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

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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 comment",
        "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",
              "old_line": null,
              "new_line": 10
            },
            "end": {
              "line_code": "588440f66559714280628a4f9799f0c4eb880a4a_11_11",
              "type": "old",
              "old_line": 11,
              "new_line": 11
            }
          }
        },
        "resolved": false,
        "resolvable": true,
        "resolved_by": null,
        "suggestions": [
          {
            "id": 1,
            "from_line": 27,
            "to_line": 27,
            "appliable": true,
            "applied": false,
            "from_content": "x",
            "to_content": "b"
          }
        ]
      }
    ]
  }
]

머지 리퀘스트 토론 항목 조회#

프로젝트 머지 리퀘스트에 대한 지정된 토론 항목을 조회합니다.

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.

성공하면 200 OK머지 리퀘스트 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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.
commit_id string 아니요 이 토론을 시작할 커밋을 참조하는 SHA.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.
position hash 아니요 diff 노트 생성 시 위치.
position[base_sha] string 예 (position*이 제공된 경우) 소스 브랜치의 베이스 커밋 SHA.
position[head_sha] string 예 (position*이 제공된 경우) 이 머지 리퀘스트의 HEAD를 참조하는 SHA.
position[start_sha] string 예 (position*이 제공된 경우) 타깃 브랜치의 커밋을 참조하는 SHA.
position[position_type] string 예 (position*이 제공된 경우) 위치 참조의 유형. 허용 값: text, image, 또는 file. file은 GitLab 16.4에서 도입됨.
position[new_path] string 예 (position type이 text인 경우) 변경 후 파일 경로.
position[old_path] string 예 (position type이 text인 경우) 변경 전 파일 경로.
position[new_line] integer 아니요 텍스트 diff 노트의 경우, 변경 후 줄 번호.
position[old_line] integer 아니요 텍스트 diff 노트의 경우, 변경 전 줄 번호.
position[line_range] hash 아니요 멀티라인 diff 노트의 줄 범위.
position[width] integer 아니요 이미지 diff 노트의 경우, 이미지 너비.
position[height] integer 아니요 이미지 diff 노트의 경우, 이미지 높이.
position[x] float 아니요 이미지 diff 노트의 경우, X 좌표.
position[y] float 아니요 이미지 diff 노트의 경우, Y 좌표.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

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

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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에 설명된 버그가 발생할 수 있습니다.

새 스레드를 생성하려면:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/versions"
  • 응답 배열에서 첫 번째로 나열된 최신 버전의 세부 정보를 확인합니다.
[
  {
    "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"
  },
  "previous versions are here"
]
  • 새 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' \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions"

멀티라인 댓글 파라미터#

멀티라인 댓글에만 지원되는 속성:

속성 유형 필수 여부 설명
position[line_range][end][line_code] string 종료 줄의 라인 코드.
position[line_range][end][type] string 이 커밋으로 추가된 줄이면 new, 그 외에는 old 사용.
position[line_range][end][old_line] integer 아니요 종료 줄의 이전 줄 번호.
position[line_range][end][new_line] integer 아니요 종료 줄의 새 줄 번호.
position[line_range][start][line_code] string 시작 줄의 라인 코드.
position[line_range][start][type] string 이 커밋으로 추가된 줄이면 new, 그 외에는 old 사용.
position[line_range][start][old_line] integer 아니요 시작 줄의 이전 줄 번호.
position[line_range][start][new_line] integer 아니요 시작 줄의 새 줄 번호.
position[line_range][end] hash 아니요 멀티라인 노트 종료 줄.
position[line_range][start] hash 아니요 멀티라인 노트 시작 줄.

line_range 속성 내의 old_linenew_line 파라미터는 멀티라인 댓글의 범위를 표시합니다. 예를 들어 "Comment on lines +296 to +297"과 같은 형식입니다.

라인 코드#

라인 코드는 _<old>_<new> 형식으로, 예를 들면 adc83b19e793491b1c6ea0fd8b46cd9f32e292fc_5_5와 같습니다.

  • 는 파일명의 SHA1 해시입니다.

  • <old>는 변경 전 줄 번호입니다.

  • <new>는 변경 후 줄 번호입니다.

예를 들어, 커밋()이 README의 463번째 줄을 삭제하는 경우, 이전 파일의 463번 줄을 참조하여 삭제에 댓글을 달 수 있습니다:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=Very clever to remove this unnecessary line!" \
  --form "path=README" \
  --form "line=463" \
  --form "line_type=old" \
  --url "https://gitlab.com/api/v4/projects/47/repository/commits//comments"

커밋()이 hello.rb의 157번째 줄을 추가하는 경우, 새 파일의 157번 줄을 참조하여 추가에 댓글을 달 수 있습니다:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=This is brilliant!" \
  --form "path=hello.rb" \
  --form "line=157" \
  --form "line_type=new" \
  --url "https://gitlab.com/api/v4/projects/47/repository/commits//comments"

머지 리퀘스트 스레드 해결#

머지 리퀘스트의 토론 스레드를 해결하거나 다시 열기합니다.

전제 조건:

  • Developer, Maintainer, 또는 Owner 권한이 있거나 검토 중인 변경의 작성자여야 합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
resolved boolean true이면 토론을 해결하거나 다시 열기.

성공하면 200 OK와 업데이트된 토론 객체를 반환합니다.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 노트 또는 답글의 내용.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
note_id integer 스레드 노트의 ID.
body string 아니요 노트 또는 답글의 내용. body 또는 resolved 중 정확히 하나를 설정해야 합니다.
resolved boolean 아니요 노트를 해결하거나 다시 열기. body 또는 resolved 중 정확히 하나를 설정해야 합니다.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

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

노트 해결:

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

머지 리퀘스트 스레드 노트 삭제#

머지 리퀘스트의 기존 스레드 노트를 삭제합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
merge_request_iid integer 머지 리퀘스트의 IID.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>/notes/<note_id>"

커밋#

모든 커밋 토론 항목 나열#

지정된 커밋에 대한 모든 토론 항목을 나열합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.

성공하면 200 OKnoteable_typeCommit으로 설정된 이슈 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions"

응답 예시:

[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "discussion text",
        "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": "reply to the discussion",
        "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": "a single comment",
        "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 comment",
        "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
      }
    ]
  }
]

커밋 토론 항목 조회#

프로젝트 커밋에 대한 지정된 토론 항목을 조회합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
discussion_id string 토론 항목의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.

성공하면 200 OK커밋 토론 항목 나열과 동일한 응답 속성을 반환합니다.

요청 예시:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.
position hash 아니요 diff 노트 생성 시 위치.
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에서 도입됨.
position[new_path] string 아니요 변경 후 파일 경로.
position[new_line] integer 아니요 변경 후 줄 번호.
position[old_path] string 아니요 변경 전 파일 경로.
position[old_line] integer 아니요 변경 전 줄 번호.
position[height] integer 아니요 이미지 diff 노트의 경우, 이미지 높이.
position[width] integer 아니요 이미지 diff 노트의 경우, 이미지 너비.
position[x] integer 아니요 이미지 diff 노트의 경우, X 좌표.
position[y] integer 아니요 이미지 diff 노트의 경우, Y 좌표.

성공하면 201 Created와 생성된 토론 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
created_at string 아니요 ISO 8601 형식의 날짜/시간 문자열(예: 2016-03-11T03:45:40Z). 관리자 또는 프로젝트/그룹 Owner 권한 필요.

성공하면 201 Created와 생성된 노트 객체를 반환합니다.

요청 예시:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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

지원되는 속성:

속성 유형 필수 여부 설명
body string 아니요 노트의 내용.
commit_id string 커밋의 SHA.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 200 OK와 업데이트된 노트 객체를 반환합니다.

요청 예시:

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

노트 해결:

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

커밋 토론 노트 삭제#

커밋의 기존 토론 노트를 삭제합니다.

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

지원되는 속성:

속성 유형 필수 여부 설명
commit_id string 커밋의 SHA.
discussion_id string 스레드의 ID.
id integer 또는 string 프로젝트의 ID 또는 URL 인코딩된 경로.
note_id integer 스레드 노트의 ID.

성공하면 204 No Content를 반환합니다.

요청 예시:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>/notes/<note_id>"