토론 API

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

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

  • 스니펫
  • 이슈
  • 에픽
  • Merge Request
  • 커밋

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

토론 페이지네이션

기본적으로 API 결과가 페이지화되어 있으므로 GET 요청은 한 번에 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-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-encoded path
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 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 string yes 노트 또는 답글의 내용입니다.
discussion_id integer yes 스레드의 ID입니다.
id integer or 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 or 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 or 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 or string yes 그룹의 ID 또는 URL-인코딩된 경로입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>"\
  "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions"

### 단일 epic 토론 항목 가져오기

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

```plaintext
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 형식의 날짜 및 시간 문자열, 예: 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"

기존 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 또는 문자열 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/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 또는 문자열 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 또는 문자열 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(Issue 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": "MergeRequest",
        "project_id": 5,
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null,
        "resolved_at": 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,
        "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 문자열 토론 항목의 ID입니다.
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 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에 새로운 스레드를 생성합니다. 메모를 작성하는 것과 유사하지만 나중에 다른 코멘트(답글)를 추가할 수 있습니다. 다른 접근 방법에 대해서는 커밋에 코멘트 작성를 참조하고, 노트 API의 새 Merge Request 노트 생성를 참조하세요.

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

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

속성 유형 필수 여부 설명
body 문자열 스레드의 내용입니다.
id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로입니다.
merge_request_iid 정수 Merge Request의 IID입니다.
position[base_sha] 문자열 제공된 경우 필수 소스 브랜치의 베이스 커밋 SHA입니다.
position[head_sha] 문자열 제공된 경우 필수 이 Merge Request의 HEAD를 참조하는 SHA입니다.
position[start_sha] 문자열 제공된 경우 필수 대상 브랜치에서 커밋을 참조하는 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"

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 매개변수를 지정한 경우, 이슈 #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]=<버전 응답의 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=테스트 코멘트 내용'\
      "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번 라인을 삭제하는 경우 이전 파일의 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"

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 문자열 커밋의 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 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(diff)에 새 스레드를 생성하는 경우와 동일합니다. 다음은 예외 사항입니다:

  • 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"

### 커밋 스레드 노트 삭제

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

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

매개변수:

속성 유형 필수 여부 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
commit_id 문자열 커밋의 SHA.
discussion_id 문자열 스레드의 ID.
note_id 정수 스레드 노트의 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"