토론 API

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

토론은 다음과 같은 관련된 노트의 집합입니다.

  • 스니펫
  • 이슈
  • 에픽
  • MR(Merge requests)
  • 커밋

이에는 댓글 및 스레드와 시스템 노트가 포함됩니다. 시스템 노트는 객체에 대한 변경 사항에 대한 노트입니다(예: 마일스톤이 변경된 경우). 레이블 노트는 이 API의 일부가 아니지만 리소스 레이블 이벤트로 따로 기록됩니다.

토론 페이지네이션

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

자세한 내용은 페이지네이션을 참조하세요.

이슈

프로젝트 이슈 토론 항목 디렉터리

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

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

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

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

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

파라미터:

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

새 이슈 스레드 생성

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

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

파라미터:

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

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

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

caution
노트는 코멘트 외의 항목에도 추가할 수 있으며, 시스템 노트 등의 항목으로 스레드를 만들 수 있습니다.
POST /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes

파라미터:

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

기존 이슈 스레드 노트 수정

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

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

매개변수:

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

이슈 스레드 노트 삭제

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

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

매개변수:

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

스니펫

프로젝트 스니펫 논의 항목 디렉터리

단일 스니펫에 대한 모든 논의 항목 디렉터리을 가져옵니다.

GET /projects/:id/snippets/:snippet_id/discussions
속성 타입 필수 설명
id integer/string yes 프로젝트 ID 또는 URL-인코딩된 경로
snippet_id integer yes 스니펫 ID
[
  {
    "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
      }
    ]
  }
]
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions"

단일 스니펫 논의 항목 가져오기

특정 프로젝트 스니펫의 단일 논의 항목을 가져옵니다.

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

매개변수:

속성 타입 필수 설명
discussion_id integer yes 논의 항목 ID
id integer or string yes 프로젝트 ID 또는 URL-인코딩된 경로
snippet_id integer yes 스니펫 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 or 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 문자열 노트 또는 답변의 내용
discussion_id 정수 스레드의 ID
id 정수 또는 문자열 프로젝트의 ID 또는 URL-encoded path
note_id 정수 스레드 노트의 ID
snippet_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/snippets/11/discussions/<discussion_id>/notes?body=comment"

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

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

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

매개변수:

속성 유형 필수 여부 설명
body 문자열 노트 또는 답변의 내용
discussion_id 정수 스레드의 ID
id 정수 또는 문자열 프로젝트의 ID 또는 URL-encoded path
note_id 정수 스레드 노트의 ID
snippet_id 정수 스니펫의 ID
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/<discussion_id>/notes/1108?body=comment"

스니펫 스레드 노트 삭제

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

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

매개변수:

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

에픽

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

그룹 에픽 토론 항목 디렉터리

단일 에픽에 대한 모든 토론 항목 디렉터리을 가져옵니다.

GET /groups/:id/epics/:epic_id/discussions
속성 유형 필수 여부 설명
epic_id 정수 에픽의 ID
id 정수 또는 문자열 그룹의 ID 또는 URL-encoded path
[
  {
    "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"

단일 epic 토론 항목 가져오기

특정 그룹 epic에 대한 단일 토론 항목을 반환합니다.

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

매개변수:

속성 유형 필수 설명
discussion_id integer yes 토론 항목의 ID입니다.
epic_id integer yes epic의 ID입니다.
id integer 또는 문자열 yes 그룹의 ID 또는 URL 인코드 된 경로입니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/<discussion_id>"

새로운 epic 스레드 생성

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

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

매개변수:

속성 유형 필수 설명
body string yes 스레드의 내용입니다.
epic_id integer yes epic의 ID입니다.
id integer 또는 문자열 yes 그룹의 ID 또는 URL 인코드 된 경로입니다.
created_at string no ISO 8601 형식의 날짜 및 시간 문자열입니다. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions?body=comment"

기존 epic 스레드에 노트 추가

스레드에 새로운 노트를 추가합니다. 이는 또한 단일 코멘트에서 스레드를 만들 수 있습니다.

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

매개변수:

속성 유형 필수 설명
body string yes 노트 또는 답글의 내용입니다.
discussion_id integer yes 스레드의 ID입니다.
epic_id integer yes epic의 ID입니다.
id integer or string yes 그룹의 ID 또는 URL 인코드 된 경로입니다.
note_id integer yes 스레드 노트의 ID입니다.
created_at string no ISO 8601 형식의 날짜 및 시간 문자열입니다. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
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"

기존 epic 스레드 노트 수정

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

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

매개변수:

속성 유형 필수 설명
body string yes 노트 또는 답글의 내용입니다.
discussion_id integer yes 스레드의 ID입니다.
epic_id integer yes epic의 ID입니다.
id integer/string yes 그룹의 ID 또는 URL 인코드 된 경로입니다.
note_id integer yes 스레드 노트의 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"

epic 스레드 노트 삭제

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

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

매개변수:

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

Merge Request

프로젝트 Merge Request 토론 항목 디렉터리

단일 Merge Request에 대한 모든 토론 항목 디렉터리을 가져옵니다.

GET /projects/:id/merge_requests/:merge_request_iid/discussions
속성 유형 필수 설명
id integer 또는 문자열 yes 프로젝트의 ID 또는 URL 인코드 된 경로입니다.
merge_request_iid integer yes Merge Request의 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
      }
    ]
  }
]

차이 코멘트는 position도 함께 포함합니다:

[
  {
    "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"

단일 Merge Request 토론 항목 가져오기

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

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

매개변수:

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

새로운 Merge Request 스레드 생성

단일 프로젝트 Merge Request에 새로운 스레드를 생성합니다. 노트를 생성하는 것과 유사하지만 다른 코멘트(답글)가 나중에 추가될 수 있습니다. 다른 방법에 대해서는 Commits API의 커밋에 댓글 게시 및 Notes API의 새로운 Merge Request 노트 생성을 참조하세요.

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

모든 코멘트를 위한 매개변수:

속성 유형 필수 설명
body string 스레드의 내용.
id integer/string 프로젝트의 ID 또는 URL-인코딩된 경로.
merge_request_iid integer Merge Request의 IID.
position[base_sha] string 제공 필수 (만약 position*이 제공되는 경우) 소스 브랜치의 기본 커밋 SHA.
position[head_sha] string 제공 필수 (만약 position*이 제공되는 경우) 이 Merge Request의 HEAD을 참조하는 SHA.
position[start_sha] string 제공 필수 (만약 position*이 제공되는 경우) 대상 브랜치에서의 커밋을 참조하는 SHA.
position[new_path] string 제공 필수 (position 유형이 text인 경우) 변경 후 파일 경로.
position[old_path] string 제공 필수 (position 유형이 text인 경우) 변경 전 파일 경로.
position[position_type] string 제공 필수 (position*이 제공되는 경우) 포지션 참조의 유형. 허용되는 값: text 또는 image.
commit_id string 아니오 이 스레드를 시작할 커밋을 참조하는 SHA.
created_at string 아니오 ISO 8601 형식의 날짜 및 시간 문자열, 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
position 해시 아니오 차이 노트를 만들 때 포지션.
position[new_line] integer 아니오 text 차이 노트의 변경 후 라인 번호.
position[old_line] integer 아니오 text 차이 노트의 변경 전 라인 번호.
position[line_range] 해시 아니오 다중 라인 차이 노트의 라인 범위.
position[width] integer 아니오 image 차이 노트의 이미지 너비.
position[height] integer 아니오 image 차이 노트의 이미지 높이.
position[x] float 아니오 image 차이 노트의 X 좌표.
position[y] float 아니오 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"

Merge Request 차이에서 새로운 스레드 생성하기

  • position[old_path]position[new_path]가 모두 필요하며 변경 전과 변경 후의 파일 경로를 나타내어야 합니다.
  • 추가된 줄(Merge Request 차이에서 초록색으로 강조 표시됨)에 스레드를 생성하려면 position[new_line]을 사용하고 position[old_line]은 포함하지 않아야 합니다.
  • 삭제된 줄(Merge Request 차이에서 빨간색으로 강조 표시됨)에 스레드를 생성하려면 position[old_line]을 사용하고 position[new_line]을 포함해서는 안 됩니다.
  • 변경되지 않은 줄에 대한 스레드를 생성하려면 해당 줄을 위해 position[new_line]position[old_line]을 모두 포함해야 합니다. 이러한 위치는 이전에 파일에서 줄 번호가 변경되었을 수 있으므로 동일하지 않을 수 있습니다. 수정에 대한 토론은 이슈 32516을 참조하세요.
  • base, head, start, 또는 SHA 매개변수를 잘못 지정하면 issue #296829)에서 설명한 버그에 직면할 수 있습니다.

새로운 스레드를 만들려면:

  1. 최신 Merge Request 버전 가져오기:

    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]=<versions 응답에서 base_commit_sha 사용>'\
      --form 'position[head_sha]=<versions 응답에서 head_commit_sha 사용>'\
      --form 'position[start_sha]=<versions 응답에서 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] string 끝 라인을 위한 라인 코드입니다.
position[line_range][end][type] string 이 커밋에서 추가된 라인의 경우 new를 사용하고, 그렇지 않으면 old를 사용하세요.
position[line_range][start][line_code] string 시작 라인을 위한 라인 코드입니다.
position[line_range][start][type] string 이 커밋에서 추가된 라인의 경우 new를 사용하고, 그렇지 않으면 old를 사용하세요.
position[line_range][end] 해시 아니요 여러 줄 주석 종료 라인입니다.
position[line_range][start] 해시 아니요 여러 줄 주석 시작 라인입니다.

라인 코드

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

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

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

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=이 불필요한 라인을 제거하는 데 아주 똑똑하군요!" \
  --form "path=README" --form "line=463" --form "line_type=old" \
  "https://gitlab.com/api/v4/projects/47/repository/commits/<COMMIT_ID>/comments"

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

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  --form "note=정말 대단하군요!" --form "path=hello.rb" \
  --form "line=157" --form "line_type=new" \
  "https://gitlab.com/api/v4/projects/47/repository/commits/<COMMIT_ID>/comments"

Merge Request 스레드 해결

Merge Request의 토론 스레드를 해결하거나 해제합니다.

전제 조건:

  • 최소한 개발자 역할이 있어야 하거나 검토 중인 변경 사항의 작성자여야 합니다.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id

매개변수:

속성 유형 필수여부 설명
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
discussion_id 문자열 스레드의 ID입니다.
merge_request_iid 정수 Merge Request의 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"

기존 Merge Request 스레드에 노트 추가

스레드에 새로운 노트를 추가합니다. 이를 통해 단일 코멘트에서 스레드를 생성할 수도 있습니다.

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

매개변수:

속성 유형 필수여부 설명
body 문자열 노트 또는 답장의 내용입니다.
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
discussion_id 문자열 스레드의 ID입니다.
merge_request_iid 정수 Merge Request의 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=comment"

기존 Merge Request 스레드 노트 수정

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

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

매개변수:

속성 유형 필수여부 설명
discussion_id 문자열 스레드의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 Merge Request의 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"

Merge Request 스레드 노트 삭제

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

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

매개변수:

속성 유형 필수여부 설명
discussion_id 문자열 스레드의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 Merge Request의 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 string yes 커밋의 SHA입니다.
id integer or 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": "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 string yes 커밋의 SHA입니다.
discussion_id string yes 토론 항목의 ID입니다.
id integer or string yes 프로젝트의 ID 또는 URL로 인코딩된 경로.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  "https://gitlab.example.com/api/v4/projects/5/repository/commits/<commit_id>/discussions/<discussion_id>"

새 커밋 스레드 생성

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

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

매개변수:

속성 타입 필수 설명
body string yes 스레드의 내용입니다.
commit_id string yes 커밋의 SHA입니다.
id integer/string yes 프로젝트의 ID 또는 URL로 인코딩된 경로.
position[base_sha] string yes (만약 position*가 제공되는 경우) 부모 커밋의 SHA입니다.
position[head_sha] string yes (만약 position*가 제공되는 경우) 이 커밋의 SHA입니다. commit_id와 동일합니다.
position[start_sha] string yes (만약 position*가 제공되는 경우) 부모 커밋의 SHA입니다.
position[position_type] string yes (만약 position*가 제공되는 경우) 위치 참조의 유형입니다. 허용된 값: text 또는 image.
created_at string no 날짜 및 시간 문자열, ISO 8601 형식에 맞게 하는 것이 좋습니다. 예: 2016-03-11T03:45:40Z. 관리자 또는 프로젝트/그룹 소유자 권한이 필요합니다.
position 해시 no 차이 코멘트를 생성할 때 위치입니다.
position[new_path] string no 변경 후 파일 경로입니다.
position[new_line] integer no 변경 후 라인 번호입니다.
position[old_path] string no 변경 전 파일 경로입니다.
position[old_line] integer no 변경 전 라인 번호입니다.
position[height] integer no image 차이 코멘트의 이미지 높이입니다.
position[width] integer no image 차이 코멘트의 이미지 너비입니다.
position[x] integer no image 차이 코멘트의 X 좌표입니다.
position[y] integer no 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 요청을 만드는 규칙은 Merge Request 차이에서 새로운 스레드를 만드는 것과 동일합니다. 예외:

  • base_sha
  • head_sha
  • start_sha

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

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

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

매개변수:

속성 유형 필수 설명
body string yes 노트나 답글의 내용
commit_id string yes 커밋의 SHA
discussion_id string yes 스레드의 ID
id integer 또는 string yes 프로젝트의 ID 또는 URL 인코딩된 경로
note_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/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 또는 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 또는 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"