Get a repository's commit comments¶
GET /api/v5/repos/{owner}/{repo}/comments
This endpoint returns the list of commit comments in the specified repository. You can paginate with the page number and per-page parameters and choose ascending or descending order, making it easier to browse and search the comments on each commit in the repository.
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 enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page; maximum 100, default 20 |
order |
query | string | No | Sort order: asc (default) / desc |
Response parameters¶
The response is an array of commit comment objects, each structured as follows:
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
body |
string | Yes | Yes | Comment content |
body_html |
string | No | Yes | HTML rendering of the comment content (not populated in the current implementation) |
created_at |
string | Yes | Yes | Comment creation time |
id |
integer | Yes | No | Comment ID |
in_reply_to_id |
integer | No | Yes | ID of the parent comment being replied to (not populated in the current implementation) |
in_reply_to_user |
object | No | Yes | Information about the author of the comment being replied to (not populated in the current implementation) |
source |
string | No | Yes | Comment source (not populated in the current implementation) |
target |
object | Yes | No | Target object associated with the comment |
updated_at |
string | Yes | Yes | Comment update time |
user |
object | Yes | No | Comment author information |
target object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
target.issue |
object | No | Yes | Associated issue (not populated in the current implementation) |
target.pull_request |
object | No | Yes | Associated pull request (not populated in the current implementation) |
user object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user.id |
integer | Yes | No | User ID |
user.login |
string | Yes | No | Login name |
user.name |
string | Yes | Yes | Username |
user.type |
string | Yes | No | User type, such as User |
user.avatar_url |
string | No | Yes | Avatar URL |
user.url |
string | No | Yes | User URL |
user.html_url |
string | No | Yes | User profile URL |
user.remark |
string | No | Yes | Enterprise remark name |
user.followers_url |
string | No | Yes | Followers list URL |
user.following_url |
string | No | Yes | Following list URL |
user.gists_url |
string | No | Yes | Gists URL |
user.starred_url |
string | No | Yes | Starred list URL |
user.subscriptions_url |
string | No | Yes | Subscriptions list URL |
user.organizations_url |
string | No | Yes | Organizations list URL |
user.repos_url |
string | No | Yes | Repositories list URL |
user.events_url |
string | No | Yes | Events list URL |
user.received_events_url |
string | No | Yes | Received events list URL |
user.permission |
string | No | Yes | User permission |
user.object_id |
string | No | Yes | Object ID |
user.email |
string | No | Yes | User email |
Error response¶
400 Parameter error
401 Unauthenticated
404 Resource not found
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¶
The example can be copied and called directly. Placeholder meanings:
Replace
<owner>with the address path of the namespace that owns the repository (address path of the enterprise, organization, or user); Replace<repo>with the repository path (path).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/comments?page=1&per_page=20&order=asc' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/comments?page=1&per_page=20&order=asc",
{
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>/comments",
params={"page": 1, "per_page": 20, "order": "asc"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"body": "This commit fixes the login issue, thanks!",
"created_at": "2024-11-06T09:43:23+08:00",
"id": 1492393,
"target": {
"issue": null,
"pull_request": null
},
"updated_at": "2024-11-06T15:18:04+08:00",
"user": {
"id": 496,
"login": "xiaogang",
"name": "xiaogang",
"type": "User"
}
}
]
Error codes¶
| Error code | Description |
|---|---|
400 |
Parameter error or the request cannot be parsed |
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
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