commits

Create a comment on a commit

Creates a comment on a commit. To comment on a specific line in a file, specify the full commit SHA, path, line, and set line_type to new.

post/api/v4/projects/{id}/repository/commits/{sha}/comments

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project

shastring required

A commit sha, or the name of a branch or tag on which to post a comment

Request body

notestring required

The text of the comment

pathstring

The file path

lineinteger required

The line number

line_type'new' | 'old' required

The type of the line

Example request

{
  "note": "Nice code!",
  "path": "doc/update/5.4-to-6.0.md",
  "line": 11
}

Response

Create a comment on a commit

notestring required
pathstring required
lineinteger required
line_typestring required
created_atstring date-time required

Example response

{
  "note": "this doc is really nice",
  "path": "README.md",
  "line": 11,
  "line_type": "new",
  "author": {
    "id": 1,
    "username": "admin",
    "public_email": "john@example.com",
    "name": "Administrator",
    "state": "active",
    "avatar_url": "https://gravatar.com/avatar/1",
    "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
    "custom_attributes": [
      {
        "key": "foo",
        "value": "bar"
      }
    ],
    "web_url": "https://gitlab.example.com/root"
  },
  "created_at": "2016-01-19T09:44:55.600Z"
}

Changes

No recorded changes to this operation across all 5 revisions of this API.