@@ -15,7 +15,9 @@ Discussions are a set of related notes on:
...
@@ -15,7 +15,9 @@ Discussions are a set of related notes on:
- Merge requests
- Merge requests
- Commits
- Commits
This includes system notes, which are notes about changes to the object (for example, when a milestone changes, a corresponding system note is added). Label notes are not part of this API, but recorded as separate events in [resource label events](resource_label_events.md).
This includes system notes, which are notes about changes to the object (for example,
when a milestone changes, a corresponding system note is added). Label notes are
not part of this API, but recorded as separate events in [resource label events](resource_label_events.md).
## Discussions pagination
## Discussions pagination
...
@@ -118,7 +120,8 @@ GET /projects/:id/issues/:issue_iid/discussions
...
@@ -118,7 +120,8 @@ GET /projects/:id/issues/:issue_iid/discussions
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/issues/11/discussions?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `body` | string | yes | The content of the note/reply |
| `body` | string | yes | The content of the note/reply |
```shell
```shell
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"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\
| `discussion_id` | integer | yes | The ID of a discussion item |
| `discussion_id` | integer | yes | The ID of a discussion item |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `body` | string | yes | The content of the note/reply |
| `body` | string | yes | The content of the note/reply |
```shell
```shell
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"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\
| `discussion_id` | integer | yes | The ID of a discussion item |
| `discussion_id` | integer | yes | The ID of a discussion item |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/groups/5/epics/11/discussions?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `body` | string | yes | The content of note/reply |
| `body` | string | yes | The content of note/reply |
```shell
```shell
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"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\
@@ -866,24 +888,34 @@ Parameters for all comments:
...
@@ -866,24 +888,34 @@ Parameters for all comments:
#### Create a new thread on the overview page
#### Create a new thread on the overview page
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
#### Create a new thread in the merge request diff
#### Create a new thread in the merge request diff
- Both `position[old_path]` and `position[new_path]` are required and must refer to the file path before and after the change.
- Both `position[old_path]` and `position[new_path]` are required and must refer
- To create a thread on an added line (highlighted in green in the merge request diff), use `position[new_line]` and don't include `position[old_line]`.
to the file path before and after the change.
- To create a thread on a removed line (highlighted in red in the merge request diff), use `position[old_line]` and don't include `position[new_line]`.
- To create a thread on an added line (highlighted in green in the merge request diff),
- To create a thread on an unchanged line, include both `position[new_line]` and `position[old_line]` for the line. These positions might not be the same if earlier changes in the file changed the line number. This is a bug that we plan to fix in [GraphQL `createDiffNote` forces clients to compute redundant information (#325161)](https://gitlab.com/gitlab-org/gitlab/-/issues/325161).
use `position[new_line]` and don't include `position[old_line]`.
- If you specify incorrect `base`/`head`/`start``SHA` parameters, you might run into the following bug: [Merge request comments receive "download" link instead of inline code (#296829)](https://gitlab.com/gitlab-org/gitlab/-/issues/296829).
- To create a thread on a removed line (highlighted in red in the merge request diff),
use `position[old_line]` and don't include `position[new_line]`.
- To create a thread on an unchanged line, include both `position[new_line]` and
`position[old_line]` for the line. These positions might not be the same if earlier
changes in the file changed the line number. This is a bug that we plan to fix in
[GraphQL `createDiffNote` forces clients to compute redundant information (#325161)](https://gitlab.com/gitlab-org/gitlab/-/issues/325161).
- If you specify incorrect `base`/`head`/`start``SHA` parameters, you might run
into the following bug:
[Merge request comments receive "download" link instead of inline code (#296829)](https://gitlab.com/gitlab-org/gitlab/-/issues/296829).
To create a new thread:
To create a new thread:
1.[Get the latest merge request version](merge_requests.md#get-mr-diff-versions):
1.[Get the latest merge request version](merge_requests.md#get-mr-diff-versions):
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7?resolved=true"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
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"
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
| `resolved` | boolean | no | Resolve/unresolve the note (exactly one of `body` or `resolved` must be set |
| `resolved` | boolean | no | Resolve/unresolve the note (exactly one of `body` or `resolved` must be set |
```shell
```shell
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>"\
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"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\
The rules for creating the API request are the same as when
The rules for creating the API request are the same as when
...
@@ -1259,7 +1299,8 @@ Parameters:
...
@@ -1259,7 +1299,8 @@ Parameters:
| `created_at` | string | no | Date time string, ISO 8601 formatted, such `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
| `created_at` | string | no | Date time string, ISO 8601 formatted, such `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
```shell
```shell
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>""https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment
curl --request POST --header"PRIVATE-TOKEN: <your_access_token>"\
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>"\
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"
curl --request PUT --header"PRIVATE-TOKEN: <your_access_token>"\