Discussions API
Discussions API
讨论是关于以下方面的一组相关注释:
- Snippets
 - Issues
 - Epics
 - 合并要求
 - Commits
 
这包括系统注释,这些注释是有关对象更改的注释(例如,当里程碑更改时,将有相应的系统注释). 标签注释不是此 API 的一部分,而是在资源标签事件中记录为单独的事件 .
Discussions pagination
默认情况下,因为 API 结果是分页的,所以GET请求一次返回 20 个结果.
阅读有关分页的更多信息.
Issues
List project issue discussion items
获取单个问题的所有讨论项目的列表.
GET /projects/:id/issues/:issue_iid/discussions 
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 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 single issue discussion item
返回特定项目问题的单个讨论项
GET /projects/:id/issues/:issue_iid/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 IID | 
 discussion_id  | 
integer | yes | 讨论项目的 ID | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7" 
Create new issue thread
为单个项目问题创建一个新线程. 这类似于创建便笺,但其他注释(回复)可以在以后添加.
POST /projects/:id/issues/:issue_iid/discussions 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 IID | 
 body  | 
string | yes | 线程的内容 | 
 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/issues/11/discussions?body=comment" 
Add note to existing issue thread
向该线程添加新注释. 这也可以从单个注释创建线程 .
警告注释可以添加到注释(系统注释等)之外的其他项目中,从而使其成为主题.
POST /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
 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/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment" 
Modify existing issue thread note
修改问题的现有线程注释.
PUT /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
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 an issue thread note
删除问题的现有主题注释.
DELETE /projects/:id/issues/:issue_iid/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 issue_iid  | 
integer | yes | 问题的 IID | 
 discussion_id  | 
integer | yes | 讨论的 ID | 
 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" 
Snippets
List project snippet discussion items
获取单个代码段的所有讨论项的列表.
GET /projects/:id/snippets/:snippet_id/discussions 
| Attribute | Type | Required | Description | 
|---|---|---|---|
 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",  "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 single snippet discussion item
返回特定项目片段的单个讨论项
GET /projects/:id/snippets/:snippet_id/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 snippet_id  | 
integer | yes | 片段的 ID | 
 discussion_id  | 
integer | yes | 讨论项目的 ID | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7" 
Create new snippet thread
Creates a new thread to a single project snippet. This is similar to creating a note but other comments (replies) can be added to it later.
POST /projects/:id/snippets/:snippet_id/discussions 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 snippet_id  | 
integer | yes | 片段的 ID | 
 body  | 
string | yes | 讨论内容 | 
 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" 
Add note to existing snippet thread
向该线程添加新注释.
POST /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 snippet_id  | 
integer | yes | 片段的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
 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/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment" 
Modify existing snippet thread note
修改代码段的现有线程注释.
PUT /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 snippet_id  | 
integer | yes | 片段的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
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 a snippet thread note
删除代码段的现有线程注释.
DELETE /projects/:id/snippets/:snippet_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 snippet_id  | 
integer | yes | 片段的 ID | 
 discussion_id  | 
integer | yes | 讨论的 ID | 
 note_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" 
Epics
List group epic discussion items
获取单个史诗的所有讨论项的列表.
GET /groups/:id/epics/:epic_id/discussions 
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_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":  "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 single epic discussion item
返回特定小组史诗的单个讨论项
GET /groups/:id/epics/:epic_id/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_id  | 
integer | yes | 史诗的 ID | 
 discussion_id  | 
integer | yes | 讨论项目的 ID | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7" 
Create new epic thread
Creates a new thread to a single group epic. This is similar to creating a note but other comments (replies) can be added to it later.
POST /groups/:id/epics/:epic_id/discussions 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_id  | 
integer | yes | 史诗的 ID | 
 body  | 
string | yes | 线程的内容 | 
 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" 
Add note to existing epic thread
向该线程添加新注释. 这也可以从单个注释创建线程 .
POST /groups/:id/epics/:epic_id/discussions/:discussion_id/notes 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_id  | 
integer | yes | 史诗的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
 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/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment" 
Modify existing epic thread note
修改史诗的现有线程注释.
PUT /groups/:id/epics/:epic_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_id  | 
integer | yes | 史诗的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
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 an epic thread note
删除史诗的现有主题注释.
DELETE /groups/:id/epics/:epic_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 组的 ID 或URL 编码的路径 | 
 epic_id  | 
integer | yes | 史诗的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 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 requests
List project merge request discussion items
获取单个合并请求的所有讨论项的列表.
GET /projects/:id/merge_requests/:merge_request_iid/discussions 
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 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  }  ]  }  ] 
差异评论还包含以下位置:
[  {  "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 single merge request discussion item
返回特定项目合并请求的单个讨论项
GET /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 discussion_id  | 
integer | yes | 讨论项目的 ID | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 
Create new merge request thread
为单个项目合并请求创建一个新线程. 这类似于创建便笺,但其他注释(回复)可以在以后添加.
POST /projects/:id/merge_requests/:merge_request_iid/discussions 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 body  | 
string | yes | 线程的内容 | 
 created_at  | 
string | no | 日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z(需要管理员或项目/组所有者权限) | 
 position  | 
hash | no | 创建差异注释时的位置 | 
 position[base_sha]  | 
string | yes | 源分支中的基本提交 SHA | 
 position[start_sha]  | 
string | yes | SHA 引用目标分支中的提交 | 
 position[head_sha]  | 
string | yes | SHA 引用此合并请求的 HEAD | 
 position[position_type]  | 
string | yes | 位置参考的类型",允许的值:"文本"或"图像" | 
 position[new_path]  | 
string | no | 更改后的文件路径 | 
 position[new_line]  | 
integer | no | 更改后的行号(用于"文本"差异注释) | 
 position[old_path]  | 
string | no | 更改前的文件路径 | 
 position[old_line]  | 
integer | no | 更改前的行号(用于"文本"差异注释) | 
 position[line_range]  | 
hash | no | 多行差异注释的行范围 | 
 position[line_range][start]  | 
hash | no | 多行音符起始行 | 
 position[line_range][start][line_code]  | 
string | yes | 起始行的行代码 | 
 position[line_range][start][type]  | 
string | yes | 起始线的线型 | 
 position[line_range][end]  | 
hash | no | 多行注释结束行 | 
 position[line_range][end][line_code]  | 
string | yes | 结束行的行代码 | 
 position[line_range][end][type]  | 
string | yes | 终点线的线型 | 
 position[width]  | 
integer | no | 图片宽度(用于"图片"差异注释) | 
 position[height]  | 
integer | no | 图片的高度(用于"图片"差异注释) | 
 position[x]  | 
integer | no | X 坐标(用于"图像"差异注释) | 
 position[y]  | 
integer | no | Y 坐标(用于"图像"差异注释) | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment" 
Resolve a merge request thread
解决/取消解决合并请求的整个线程.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 resolved  | 
boolean | yes | 解决/取消讨论 | 
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7?resolved=true" 
Add note to existing merge request thread
向该线程添加新注释. 这也可以从单个注释创建线程 .
POST /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
 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/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment" 
Modify an existing merge request thread note
修改或解决合并请求的现有线程注释.
PUT /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | no |  备注/回复的内容(必须是body或已resolved的内容之一)  | 
 resolved  | 
boolean | no |  解析/取消解析音符(必须设置为刚好为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 a merge request thread note
删除合并请求的现有线程注释.
DELETE /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 merge_request_iid  | 
integer | yes | 合并请求的 IID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/636" 
Commits
List project commit discussion items
获取单个提交的所有讨论项的列表.
GET /projects/:id/commits/:commit_id/discussions 
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_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":  "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  }  ]  }  ] 
差异评论还包含以下位置:
[  {  "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 single commit discussion item
返回特定项目提交的单个讨论项
GET /projects/:id/commits/:commit_id/discussions/:discussion_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_id  | 
integer | yes | 提交的 ID | 
 discussion_id  | 
integer | yes | 讨论项目的 ID | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7" 
Create new commit thread
为单个项目提交创建一个新线程. 这类似于创建便笺,但其他注释(回复)可以在以后添加.
POST /projects/:id/commits/:commit_id/discussions 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_id  | 
integer | yes | 提交的 ID | 
 body  | 
string | yes | 线程的内容 | 
 created_at  | 
string | no | 日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z(需要管理员或项目/组所有者权限) | 
 position  | 
hash | no | 创建差异注释时的位置 | 
 position[base_sha]  | 
string | yes | 源分支中的基本提交 SHA | 
 position[start_sha]  | 
string | yes | SHA 引用目标分支中的提交 | 
 position[head_sha]  | 
string | yes | SHA 引用此提交的 HEAD | 
 position[position_type]  | 
string | yes | 位置参考的类型",允许的值:"文本"或"图像" | 
 position[new_path]  | 
string | no | 更改后的文件路径 | 
 position[new_line]  | 
integer | no | 变更后的行号 | 
 position[old_path]  | 
string | no | 更改前的文件路径 | 
 position[old_line]  | 
integer | no | 更改前的行号 | 
 position[width]  | 
integer | no | 图片宽度(用于"图片"差异注释) | 
 position[height]  | 
integer | no | 图片的高度(用于"图片"差异注释) | 
 position[x]  | 
integer | no | X 坐标(用于"图像"差异注释) | 
 position[y]  | 
integer | no | Y 坐标(用于"图像"差异注释) | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions?body=comment" 
Add note to existing commit thread
向该线程添加新注释.
POST /projects/:id/commits/:commit_id/discussions/:discussion_id/notes 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_id  | 
integer | yes | 提交的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
 body  | 
string | yes | 备注/回复的内容 | 
 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/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment 
Modify an existing commit thread note
修改或解决提交的现有线程注释.
PUT /projects/:id/commits/:commit_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_id  | 
integer | yes | 提交的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 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/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 a commit thread note
删除提交的现有线程注释.
DELETE /projects/:id/commits/:commit_id/discussions/:discussion_id/notes/:note_id 
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 id  | 
integer/string | yes | 项目的 ID 或URL 编码的路径 | 
 commit_id  | 
integer | yes | 提交的 ID | 
 discussion_id  | 
integer | yes | 线程的 ID | 
 note_id  | 
integer | yes | 线程注释的 ID | 
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/636"