Use this API to manage draft notes. These notes are pending, unpublished comments on merge requests. Draft notes can start a discussion, or continue an existing discussion as a reply.
Before publishing, draft notes are visible only to the author.
List all merge request draft notes
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes
Lists all merge request draft notes.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Create a draft note
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes
Creates a draft note for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
commit_ | String | The sha of a commit to associate the draft note to |
in_ | String | The ID of a discussion the draft note replies to |
noteRequired | String | The content of a note |
position | Object | Position when creating a note |
position.Required | String | Base commit SHA in the source branch |
position.Required | String | SHA referencing HEAD of this merge request |
position. | Integer | Height of the image |
position. | Object | Line range for a multi- |
position. | Object | End line for a multi- |
position. | String | End line code for multi- |
position. | Integer | End new_ |
position. | Integer | End old_ |
position. | String | End line type for multi- |
position. | Object | Start line for a multi- |
position. | String | Start line code for multi- |
position. | Integer | Start new_ |
position. | Integer | Start old_ |
position. | String | Start line type for multi- |
position. | Integer | Line number after change |
position. | String | File path after change |
position. | Integer | Line number before change |
position. | String | File path before change |
position.Required | String | Type of the position reference Allowed values: text,image,fileMinimum length: 1 |
position.Required | String | SHA referencing commit in target branch |
position. | Integer | Width of the image |
position. | Integer | X coordinate in the image |
position. | Integer | Y coordinate in the image |
resolve_ | Boolean | The associated discussion should be resolved |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Publish all pending draft notes
POST /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes/bulk_publish
Publishes all pending draft notes for the current user on the specified merge request. Optionally sets the reviewer state and posts a summary note.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
internal | Boolean | If true, Default: false |
note | String | Summary note body to post on the merge request |
reviewer_ | String | Set reviewer review state after publishing. Allowed values: requested_,reviewed |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve a draft note
GET /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes/{draft_note_id}
Retrieves a draft note for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
draft_Path, | Integer | The ID of a draft note |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Update a draft note
PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes/{draft_note_id}
Updates a draft note for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
draft_Path, | Integer | The ID of a draft note |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
note | String | The content of a note |
position | Object | Position when creating a note |
position.Required | String | Base commit SHA in the source branch |
position.Required | String | SHA referencing HEAD of this merge request |
position. | Integer | Height of the image |
position. | Object | Line range for a multi- |
position. | Object | End line for a multi- |
position. | String | End line code for multi- |
position. | Integer | End new_ |
position. | Integer | End old_ |
position. | String | End line type for multi- |
position. | Object | Start line for a multi- |
position. | String | Start line code for multi- |
position. | Integer | Start new_ |
position. | Integer | Start old_ |
position. | String | Start line type for multi- |
position. | Integer | Line number after change |
position. | String | File path after change |
position. | Integer | Line number before change |
position. | String | File path before change |
position.Required | String | Type of the position reference Allowed values: text,image,fileMinimum length: 1 |
position.Required | String | SHA referencing commit in target branch |
position. | Integer | Width of the image |
position. | Integer | X coordinate in the image |
position. | Integer | Y coordinate in the image |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Delete a draft note
DELETE /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes/{draft_note_id}
Deletes a draft note for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
draft_Path, | Integer | The ID of a draft note |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Publish a draft note
PUT /api/v4/projects/{id}/merge_requests/{merge_request_iid}/draft_notes/{draft_note_id}/publish
Publishes a draft note for a specified merge request.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a project |
merge_Path, | Integer | The ID of a merge request |
draft_Path, | Integer | The ID of a draft note |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesDraftNote
| Property | Type | Description |
|---|---|---|
author_ | Integer (int64) | Example:4 |
commit_ | String | Example:6104942438c14ec7bd21 |
discussion_ | String | Example:6a9c1750b37d513a4398 |
id | Integer (int64) | Example:2 |
line_ | String | Example:1c497fbb3a46b78edf0_ |
merge_ | Integer (int64) | Example:52 |
note | String | Example:This is a note |
position | Object | Example:{"base_ |
resolve_ | Boolean | Example:true |