ディスカッション API

ディスカッションは、関連するノートのセットです:

  • スニペット
  • イシュー
  • エピック
  • マージリクエスト
  • コミット

これには、オブジェクトの変更に関するメモであるシステムノートも含まれます(例えば、マイルストーンが変更されると、対応するシステムノートが存在します)。 ラベルノートはこの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": "discussion text",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-03T21:54:39.668Z",
        "updated_at": "2018-03-03T21:54:39.668Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "noteable_iid": null
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "reply to the discussion",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "a single comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Issue",
        "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/6a9c1750b37d513a43987b574953fceb50b03ce7"

新しいイシュー・スレッドの作成

1つのプロジェクトのイシューに新しいスレッドを作成します。 これはノートの作成と似ていますが、他のコメント(返信)を後から追加することができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
issue_iid 整数 はい イシューのIID
body はい スレッドの内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions?body=comment"

既存のイシュー・スレッドにメモを追加

スレッドに新しいノートを追加します。1つのコメントからスレッドを作成することもできます。

警告コメント以外の項目(システムノートなど)にもメモを追加してスレッドにすることができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
issue_iid 整数 はい イシューのIID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"

既存のイシュー・スレッド・ノートの修正

イシューに関する既存のスレッドノートを修正します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
issue_iid 整数 はい イシューのIID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment"

イシューのスレッドノートの削除

イシューの既存のスレッドノートを削除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
issue_iid 整数 はい イシューのIID
discussion_id 整数 はい ディスカッションのID
note_id 整数 はい ディスカッションノートのID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/636"

スニペット

プロジェクトスニペットのディスカッション項目一覧

1つのスニペットに関するすべてのディスカッション項目のリストを取得します。

GET /projects/:id/snippets/:snippet_id/discussions
属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットの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",
        "noteable_id": 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",
        "noteable_id": 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",
        "noteable_id": 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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットのID
discussion_id 整数 はい ディスカッションアイテムのID
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7"

新しいスニペットスレッドの作成

1つのプロジェクトスニペットに対して新しいスレッドを作成します。 これはノートを作成するのと似ていますが、他のコメント(返信)を後から追加することができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットのID
body はい ディスカッションの内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットのID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"

既存のスニペットスレッドノートの修正

スニペットの既存のスレッドノートを変更します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットのID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment"

スニペットスレッドノートの削除

スニペットの既存のスレッドノートを削除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
snippet_id 整数 はい スニペットのID
discussion_id 整数 はい ディスカッションのID
note_id 整数 はい ディスカッションノートのID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/636"

エピック

グループエピック討議項目一覧

単一のエピックに関するすべてのディスカッション項目のリストを取得します。

GET /groups/:id/epics/:epic_id/discussions
属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックの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": "Epic",
        "noteable_id": null,
        "resolvable": false
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "reply to the discussion",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Epic",
        "noteable_id": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "a single comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Epic",
        "noteable_id": 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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックのID
discussion_id 整数 はい ディスカッションアイテムのID
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7"

新しいエピック・スレッドを作成

1つのグループエピックに新しいスレッドを作成します。 これはノートの作成に似ていますが、他のコメント(返信)を後から追加することができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックのID
body はい スレッドの内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions?body=comment"

既存のエピック・スレッドに注釈を追加

スレッドに新しいノートを追加します。1つのコメントからスレッドを作成することもできます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックのID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"

既存のエピックスレッドノートの修正

エピックの既存のスレッドノートを修正します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックのID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment"

エピックスレッドノートの削除

エピックの既存のスレッドノートを削除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい グループのIDまたはURLエンコードされたパス
epic_id 整数 はい エピックのID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/636"

マージリクエスト

プロジェクトマージリクエストのディスカッション項目一覧

ひとつのマージリクエストに対するすべてのディスカッションアイテムのリストを取得します。

GET /projects/:id/merge_requests/:merge_request_iid/discussions
属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
[
  {
    "id": "6a9c1750b37d513a43987b574953fceb50b03ce7",
    "individual_note": false,
    "notes": [
      {
        "id": 1126,
        "type": "DiscussionNote",
        "body": "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": "Merge request",
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": 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": "Merge request",
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "a single comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Merge request",
        "noteable_iid": null,
        "resolved": false,
        "resolvable": true,
        "resolved_by": null
      }
    ]
  }
]

Diffのコメントにはポジションも含まれています:

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": DiffNote,
        "body": "diff comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Merge request",
        "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,
          "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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
discussion_id 整数 はい ディスカッションアイテムのID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7

新しいマージリクエストスレッドの作成

1つのプロジェクトのマージリクエストに新しいスレッドを作成します。 これはノートの作成に似ていますが、他のコメント(返信)を後で追加することができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
body はい スレッドの内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
position ハッシュ いいえ 差分ノート作成時の位置
position[base_sha] はい ソースブランチのベースコミットSHA
position[start_sha] はい ターゲットブランチのコミットを参照する SHA
position[head_sha] はい このマージリクエストのHEADを参照するSHA
position[position_type] はい 位置参照のタイプ」、許可される値:’text’または’image’
position[new_path] いいえ 変更後のファイルパス
position[new_line] 整数 いいえ 変更後の行番号(「テキスト」差分ノートの場合)
position[old_path] いいえ 変更前のファイルパス
position[old_line] 整数 いいえ 変更前の行番号 (「テキスト」差分ノートの場合)
position[line_range] ハッシュ いいえ 複数行の差分音符の行範囲
position[line_range][start] ハッシュ いいえ マルチラインノート
position[line_range][start][line_code] はい スタートラインのラインコード
position[line_range][start][type] はい スタートラインのラインタイプ
position[line_range][end] ハッシュ いいえ マルチラインノートの終了行
position[line_range][end][line_code] はい 終了行の行コード
position[line_range][end][type] はい エンドラインのラインタイプ
position[width] 整数 いいえ 画像の幅(’image’差分ノートの場合)
position[height] 整数 いいえ 画像の高さ(’image’差分ノートの場合)
position[x] 整数 いいえ X座標(’イメージ’差分ノート用)
position[y] 整数 いいえ Y座標(「イメージ」差分ノート用)
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment"

マージリクエストスレッドの解決

マージリクエストのスレッド全体を解決/解決解除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
discussion_id 整数 はい スレッドのID
resolved ブーリアン はい 議論の解決・未解決
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7?resolved=true"

既存のマージリクエストスレッドにメモを追加

スレッドに新しいノートを追加します。1つのコメントからスレッドを作成することもできます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"

既存のマージリクエストスレッドノートの修正

マージリクエストの既存のスレッドノートを修正または解決します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body いいえ メモ/返信の内容(body またはresolved のうち、いずれか1つが設定されている必要があります。
resolved ブーリアン いいえ ノートの解決/未解決(body またはresolved のどちらか一方が設定されている必要があります。
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/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/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?resolved=true"

マージリクエストスレッドノートの削除

マージリクエストの既存のスレッドノートを削除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
merge_request_iid 整数 はい マージリクエストのIID
discussion_id 整数 はい スレッドのID
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/commits/:commit_id/discussions
属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの 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": "Commit",
        "noteable_iid": null,
        "resolvable": false
      },
      {
        "id": 1129,
        "type": "DiscussionNote",
        "body": "reply to the discussion",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T13:38:02.127Z",
        "updated_at": "2018-03-04T13:38:02.127Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  },
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": true,
    "notes": [
      {
        "id": 1128,
        "type": null,
        "body": "a single comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "noteable_iid": null,
        "resolvable": false
      }
    ]
  }
]

Diffのコメントにはポジションも含まれています:

[
  {
    "id": "87805b7c09016a7058e91bdbe7b29d1f284a39e6",
    "individual_note": false,
    "notes": [
      {
        "id": 1128,
        "type": DiffNote,
        "body": "diff comment",
        "attachment": null,
        "author": {
          "id": 1,
          "name": "root",
          "username": "root",
          "state": "active",
          "avatar_url": "https://www.gravatar.com/avatar/00afb8fb6ab07c3ee3e9c1f38777e2f4?s=80&d=identicon",
          "web_url": "http://localhost:3000/root"
        },
        "created_at": "2018-03-04T09:17:22.520Z",
        "updated_at": "2018-03-04T09:17:22.520Z",
        "system": false,
        "noteable_id": 3,
        "noteable_type": "Commit",
        "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/commits/11/discussions"

単一コミットのディスカッション項目の取得

特定のプロジェクトコミットに関する単一のディスカッション項目を返します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの ID
discussion_id 整数 はい ディスカッションアイテムのID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7"

新しいコミットスレッドの作成

一つのプロジェクトコミットに対して新しいスレッドを作成します。 これはノートを作成するのと似ていますが、他のコメント(返信)を後から追加することができます。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの ID
body はい スレッドの内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
position ハッシュ いいえ 差分ノート作成時の位置
position[base_sha] はい ソースブランチのベースコミットSHA
position[start_sha] はい ターゲットブランチのコミットを参照する SHA
position[head_sha] はい このコミットの HEAD を参照する SHA
position[position_type] はい 位置参照のタイプ」、許可される値:’text’または’image’
position[new_path] いいえ 変更後のファイルパス
position[new_line] 整数 いいえ 変更後の行番号
position[old_path] いいえ 変更前のファイルパス
position[old_line] 整数 いいえ 変更前の行番号
position[width] 整数 いいえ 画像の幅(’image’差分ノートの場合)
position[height] 整数 いいえ 画像の高さ(’image’差分ノートの場合)
position[x] 整数 いいえ X座標(’イメージ’差分ノート用)
position[y] 整数 いいえ Y座標(「イメージ」差分ノート用)
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions?body=comment"

既存のコミットスレッドにメモを追加

スレッドに新しいメモを追加します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの ID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body はい メモ/返信の内容
created_at いいえ ISO 8601形式の日付時刻文字列(例:2016-03-11T03:45:40Z)(adminまたはプロジェクト/グループのオーナー権限が必要です。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment

既存のコミットスレッドノートの修正

コミットに関する既存のスレッドノートを修正または解決します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの ID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
body いいえ メモの内容
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment"

メモの解決

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

コミットスレッドノートの削除

コミットに関する既存のスレッドノートを削除します。

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

パラメーター

属性 タイプ 必須 説明
id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
commit_id 整数 はい コミットの ID
discussion_id 整数 はい スレッドのID
note_id 整数 はい スレッドノートのID
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/636"