Skip to content

Get a single commit comment

GET /api/v5/repos/{owner}/{repo}/commits/{ref}/comments

This endpoint returns the comment list for a specific commit in the specified repository, with pagination. It returns the content, creation and update times of each comment, as well as information about the user who posted it.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace that owns the repository (address path of the organization or user)
repo path string Yes Repository path (path)
ref path string Yes Commit SHA
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, default 20

Response parameters

This endpoint returns an array, each element of which is a commit comment object.

Field Type Always returned Nullable Description
body string Yes Yes Comment content
created_at string Yes Yes Comment creation time
id integer Yes No Comment ID
updated_at string Yes Yes Comment update time
user object Yes No Information about the user who posted the comment

user object

Field Type Always returned Nullable Description
user.id integer Yes No User ID
user.login string Yes Yes User login name
user.name string Yes Yes User name
user.type string Yes Yes User type

Error response

The reference documentation for this endpoint does not provide a failure response example. Use the HTTP status code to determine the error type; the actual error fields are those returned by the backend.

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Authentication required
403 Forbidden
404 Resource not found

Request example

Parameter description

This endpoint allows anonymous access. You can also pass an AtomGit user access token via ?access_token=<token>.

Replace <owner> with the address path of the namespace that owns the repository (address path of the organization or user); Replace <repo> with the repository path (path); Replace <ref> with the commit SHA.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/commits/<ref>/comments?page=1&per_page=20' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/commits/<ref>/comments?page=1&per_page=20", {
  headers: {
    "Accept": "application/json",
  },
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/commits/<ref>/comments",
    params={"page": 1, "per_page": 20},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "body": "11111",
    "created_at": "2024-11-19T11:22:50+08:00",
    "id": 13837749,
    "updated_at": "2024-11-19T11:22:50+08:00",
    "user": {
      "id": 173794,
      "login": "xiaogang",
      "name": "Xiao Gang",
      "type": "User"
    }
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Parameter error or the request cannot be parsed
404 The requested path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc