토론 API

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

토론은 다음과 관련된 노트 세트입니다:

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

여기에는 댓글 및 스레드 및 시스템 노트가 포함됩니다. 시스템 노트는 객체에 대한 변경 사항에 대한 노트입니다(예: 마일스톤 변경 시). 라벨 노트는 이 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-encoded path.
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-encoded path.
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-encoded path.
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 문자열 노트 또는 답글의 내용.
discussion_id 정수 쓰레드의 ID.
id 정수 또는 문자열 프로젝트의 ID 또는 URL-encoded path.
issue_iid 정수 이슈의 IID.
note_id 정수 쓰레드 노트의 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 정수 토론의 ID.
id 정수 또는 문자열 프로젝트의 ID 또는 URL-encoded path.
issue_iid 정수 이슈의 IID.
note_id 정수 토론 노트의 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 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id 정수 코드 조각의 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 정수 토론 항목의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
snippet_id 정수 코드 조각의 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 yes 토론 내용입니다.
id integer 또는 string yes 프로젝트의 ID 또는 URL로 인코딩된 경로입니다.
snippet_id integer yes 스니펫의 ID입니다.
created_at string no 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 yes 메모 또는 답글 내용입니다.
discussion_id integer yes 스레드의 ID입니다.
id integer 또는 string yes 프로젝트의 ID 또는 URL로 인코딩된 경로입니다.
note_id integer yes 스레드 메모의 ID입니다.
snippet_id integer yes 스니펫의 ID입니다.
created_at string no 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 yes 메모 또는 답글 내용입니다.
discussion_id integer yes 스레드의 ID입니다.
id integer 또는 string yes 프로젝트의 ID 또는 URL로 인코딩된 경로입니다.
note_id integer yes 스레드 메모의 ID입니다.
snippet_id integer yes 스니펫의 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 integer yes 토론의 ID입니다.
id integer 또는 string yes 프로젝트의 ID 또는 URL로 인코딩된 경로입니다.
note_id integer yes 토론 메모의 ID입니다.
snippet_id integer yes 스니펫의 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

그룹 에픽 토론 항목 목록

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

GET /groups/:id/epics/:epic_id/discussions
속성 유형 필수여부 설명
epic_id integer yes 에픽의 ID입니다.
id integer 또는 string yes 그룹의 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 integer 토론 항목의 ID입니다.
epic_id integer 에픽의 ID입니다.
id integer 또는 문자열 그룹의 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 string 스레드의 내용입니다.
epic_id integer 에픽의 ID입니다.
id integer 또는 문자열 그룹의 ID 또는 URL 인코딩된 경로입니다.
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/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 또는 문자열 그룹의 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/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 또는 문자열 그룹의 ID 또는 URL 인코딩된 경로입니다.
note_id integer 스레드 노트의 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 integer 스레드의 ID입니다.
epic_id integer 에픽의 ID입니다.
id integer 또는 문자열 그룹의 ID 또는 URL 인코딩된 경로입니다.
note_id integer 스레드 노트의 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
      }
    ]
  }
]

차이 코멘트는 위치도 포함합니다:

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": "DiffNote",
        "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,
        "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 문자열 토론 항목의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL로 인코딩된 경로.
merge_request_iid 정수 병합 요청의 IID입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/<discussion_id>"

새로운 병합 요청 스레드 생성

단일 프로젝트 병합 요청에 새로운 스레드를 생성합니다. 노트를 작성하는 것과 유사하지만 나중에 다른 코멘트(답글)를 추가할 수 있습니다. 다른 방법에 대해서는 커밋에 코멘트 작성에서 Commits API를 참조하세요. 그리고 노트 API에서 새로운 병합 요청 노트 생성을 참조하세요.

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

모든 코멘트에 대한 매개변수:

속성 유형 필수 여부 설명  
body 문자열 스레드의 내용입니다.  
id 정수/문자열 프로젝트의 ID 또는 URL로 인코딩된 경로.  
merge_request_iid 정수 병합 요청의 IID입니다.  
position[base_sha] 문자열 선택 사항 (position*가 제공되는 경우 필수) 소스 브랜치의 기본 커밋 SHA입니다.  
position[head_sha] 문자열 선택 사항 (position*가 제공되는 경우 필수) 이 병합 요청의 HEAD를 참조하는 SHA입니다.  
position[start_sha] 문자열 선택 사항 (position*가 제공되는 경우 필수) 대상 브랜치에서 커밋을 참조하는 SHA입니다.  
position[new_path] 문자열 선택 사항 (position 유형이 text인 경우 필수) 변경 후 파일 경로입니다.  
position[old_path] 문자열 선택 사항 (position 유형이 text인 경우 필수) 변경 전 파일 경로입니다.  
position[position_type] 문자열 선택 사항 (position*이 제공되는 경우 필수) 위치 참조의 유형입니다. 허용된 값: text 또는 image.  
commit_id 문자열 아니오 이 스레드를 시작하는 커밋을 참조하는 SHA입니다.  
created_at 문자열 아니오 날짜 및 시간 문자열, ISO 8601 형식으로 작성된 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.  
position 해시 아니오 차이 노트를 생성할 때의 위치입니다.  
position[new_line] 정수 아니오 text 차이 노트의 경우, 변경 후의 라인 번호입니다.  
position[old_line] 정수 아니오 text 차이 노트의 경우, 변경 전의 라인 번호입니다.  
position[line_range] 해시 아니오 여러 줄 차이 노트의 라인 범위입니다.  
position[width] 정수 아니오 image 차이 노트의 이미지 너비입니다.  
position[height] 정수 아니오 image 차이 노트의 이미지 높이입니다.  
position[x] 부동 아니오 image 차이 노트의 X 좌표입니다.  
position[y] 부동 아니오 image 차이 노트의 Y 좌표입니다.  

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

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

병합 요청 차이에서 새로운 스레드 생성

  • position[old_path]position[new_path] 모두 필수이며 변경 전과 후의 파일 경로를 참조해야 합니다.
  • 추가된 줄(병합 요청 차이에서 초록색으로 표시됨)에 스레드를 생성하려면 position[new_line]을 사용하고 position[old_line]를 포함하지 않아야 합니다.
  • 제거된 줄(병합 요청 차이에서 빨간색으로 표시됨)에 스레드를 생성하려면 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. 새로운 차이 스레드를 생성합니다. 이 예제는 추가된 줄에 스레드를 생성합니다:

    curl --request POST --header "PRIVATE-TOKEN: <your_access_token>"\
      --form 'position[position_type]=text'\
      --form 'position[base_sha]=<버전 응답에서 가져온 base_commit_sha 사용>'\
      --form 'position[head_sha]=<버전 응답에서 가져온 head_commit_sha 사용>'\
      --form 'position[start_sha]=<버전 응답에서 가져온 start_commit_sha 사용>'\
      --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번째 라인을 삭제한다면, 이전 파일에서 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번째 라인을 추가한다면, 새로운 파일에서 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 문자열 노트나 답글의 내용.
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
discussion_id 문자열 스레드의 ID입니다.
merge_request_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/merge_requests/11/discussions/<discussion_id>/notes?body=코멘트"

기존 병합 요청 스레드 노트 수정

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

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

매개변수:

속성 유형 필수여부 설명
discussion_id 문자열 스레드의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 병합 요청의 IID입니다.
note_id 정수 스레드 노트의 ID입니다.
body 문자열 아니오 노트 또는 답변의 내용입니다. body 또는 resolved 중 정확히 하나를 설정해야 합니다.
resolved 부울 아니오 노트를 해결하거나 해제합니다. 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 문자열 스레드의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 병합 요청의 IID입니다.
note_id 정수 스레드 노트의 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
      }
    ]
  }
]

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

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": "DiffNote",
        "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,
        "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 문자열 커밋의 SHA입니다.
discussion_id 문자열 토론 항목의 ID입니다.
id 정수 또는 문자열 프로젝트의 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 문자열 쓰레드의 내용입니다.
commit_id 문자열 커밋의 SHA입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL-인코딩된 경로입니다.
position[base_sha] 문자열 제공시 필수 부모 커밋의 SHA입니다.
position[head_sha] 문자열 제공시 필수 현재 커밋의 SHA입니다. commit_id와 동일합니다.
position[start_sha] 문자열 제공시 필수 부모 커밋의 SHA입니다.
position[position_type] 문자열 제공시 필수 위치 참조의 유형입니다. 허용되는 값: text 또는 image
created_at 문자열 아니요 ISO 8601 형식의 날짜 및 시간 문자열, 예: 2016-03-11T03:45:40Z입니다. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
position 해시 아니요 차이 노트를 생성할 때의 위치입니다.
position[new_path] 문자열 아니요 변경 후 파일 경로입니다.
position[new_line] 정수 아니요 변경 후 라인 번호입니다.
position[old_path] 문자열 아니요 변경 전 파일 경로입니다.
position[old_line] 정수 아니요 변경 전 라인 번호입니다.
position[height] 정수 아니요 image 차이 노트의 이미지 높이입니다.
position[width] 정수 아니요 image 차이 노트의 이미지 너비입니다.
position[x] 정수 아니요 image 차이 노트의 X 좌표입니다.
position[y] 정수 아니요 image 차이 노트의 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 요청 생성 규칙은 동일하지만 병합 요청 차이에서 새 쓰레드를 작성하는 것과 비교하여 다음과 같은 예외가 있습니다:

  • base_sha
  • head_sha
  • start_sha

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

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

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

매개변수:

속성 타입 필수 설명
body 문자열 메모 또는 답글의 내용입니다.
commit_id 문자열 커밋의 SHA입니다.
discussion_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/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 yes 커밋의 SHA 값
discussion_id string yes 스레드의 ID
id integer or string yes 프로젝트의 ID 또는 URL 인코딩된 경로
note_id integer yes 스레드 노트의 ID
body string no 노트의 내용
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 yes 프로젝트의 ID 또는 URL 인코딩된 경로
commit_id string yes 커밋의 SHA 값
discussion_id string yes 스레드의 ID
note_id integer yes 스레드 노트의 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"