Skip to content

Get all issue comments in a repository

GET /api/v5/repos/{owner}/{repo}/issues/comments

Retrieves the comments of all issues in the specified repository, with sorting by creation or update time, a specified sort direction, and pagination, and filtering by time for the most recently updated comments.

Access token support

  • AtomGit user access token (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 (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path (path)
sort query string No Sort by field; supports created or updated, defaults to created
direction query string No Sort direction; supports asc / desc
since query string No Returns only comments updated at or after this time. For example: 2024-11-20T13:00:21+08:00 (note that + must be URL-encoded as %2B)
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, defaults to 20

Response parameters

This endpoint returns an array whose elements are comment objects; the fields are described below:

Field Type Always returned Nullable Description
id integer Yes No Comment ID
body string Yes No Comment content
user object Yes No Information about the commenting user
target object Yes No Comment target object
created_at string Yes No Creation time
updated_at string Yes Yes Update time; may be null

user object

Field Type Always returned Nullable Description
user.avatar_url string Yes No User avatar URL
user.html_url string Yes No User homepage URL
user.id string Yes No User ID
user.login string Yes No User login name
user.name string Yes No User nickname
user.events_url string Yes Yes Events URL; may be null
user.followers_url string Yes Yes Followers URL; may be null
user.following_url string Yes Yes Following list URL; may be null
user.gists_url string Yes Yes Gist URL; may be null
user.member_role string Yes Yes Member role; may be null
user.organizations_url string Yes Yes Organizations URL; may be null
user.received_events_url string Yes Yes Received events URL; may be null
user.remark string Yes Yes Remark; may be null
user.repos_url string Yes Yes Repository URL; may be null
user.starred_url string Yes Yes Starred URL; may be null
user.subscriptions_url string Yes Yes Subscriptions URL; may be null
user.type string Yes Yes User type; may be null
user.url string Yes Yes User URL; may be null

target object

Field Type Always returned Nullable Description
target.issue object Yes No Issue object associated with the comment

target.issue object

Field Type Always returned Nullable Description
target.issue.id integer Yes No Issue ID
target.issue.title string Yes No Issue title
target.issue.nubmer integer Yes No Issue number
target.issue.created_at string Yes No Issue creation time
target.issue.updated_at string Yes Yes Issue update time; may be null

Error responses

The reference documentation defines no specific business-level error response body for this endpoint; the structure of a failure response depends on what the backend actually returns.

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication (Requires authentication)
403 Forbidden (Forbidden)
404 Resource not found (Not Found)
500 Internal server error (Internal Server Error)

Request example

Parameter notes

  • <owner> — replace with the address path of the namespace that owns the repository (the address path of an enterprise, organization, or individual)
  • <repo> — replace with the repository path (path)

This endpoint allows anonymous access, so the examples may omit the access token; to include one, append access_token=<token> to the URL.

cURL

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

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/comments?sort=created&direction=desc&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>/issues/comments",
    params={"sort": "created", "direction": "desc", "page": 1, "per_page": 20},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 272201,
    "body": "This is a comment.",
    "user": {
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "events_url": null,
      "followers_url": null,
      "following_url": null,
      "gists_url": null,
      "html_url": "https://api.atomgit.com/dengmengmian",
      "id": "661ce4eab470b1430d456154",
      "login": "dengmengmian",
      "member_role": null,
      "name": "Ma Fan_",
      "organizations_url": null,
      "received_events_url": null,
      "remark": null,
      "repos_url": null,
      "starred_url": null,
      "subscriptions_url": null,
      "type": null,
      "url": null
    },
    "target": {
      "issue": {
        "id": 152642,
        "title": "Half-month report",
        "nubmer": 15,
        "created_at": "2024-04-20T15:20:30.104+08:00",
        "updated_at": null
      }
    },
    "created_at": "2024-04-20T15:20:30.104+08:00",
    "updated_at": null
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credential)
400 Invalid parameters or unparsable request
404 Request path does not exist
405 Unsupported request method
429 Too many requests; rate limit triggered
500 Internal server error

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