Skip to content

Get all comments of an issue in a repository

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

Retrieves all comments of an issue in the specified repository, with pagination, sorting, and filtering by the start of the update time range, returning the content, author, and linked issue of each comment.

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)
number path string Yes Issue number (case-sensitive; no need to add the # sign)
access_token query string No User authorization code
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, defaults to 20
order query string No Sort order: asc (default) / desc
since query string No Start of the update time range; the time format must be 2024-11-10T08:10:30.000+08:00 (note that + must be URL-encoded as %2B)

Response parameters

The response is an array of comment objects; each comment contains the following fields:

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 user who posted the comment
target object Yes No Comment target (the linked issue)
created_at string Yes No Comment creation time
updated_at string Yes No Comment update time

user object

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

target object

Field Type Always returned Nullable Description
target.issue object Yes No Issue 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

Error responses

This endpoint has no business-level error responses.

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication (Requires authentication)
403 Forbidden (Forbidden)
404 Request path does not exist (Not found)

Request example

Parameter notes

Replace <owner> with the address path of the namespace that owns the repository (the address path of an enterprise, organization, or individual); replace <repo> with the repository path (path); replace <number> with the issue number (case-sensitive; no need to add the # sign).

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/issues/<number>/comments?page=1&per_page=20&order=asc' \
  -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/<number>/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>/issues/<number>/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

[
  {
    "id": 271624,
    "body": "Comment content.",
    "user": {
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "html_url": "https://api.atomgit.com/dengmengmian",
      "id": "661ce4eab470b1430d456154",
      "login": "dengmengmian",
      "name": "Ma Fan_"
    },
    "target": {
      "issue": {
        "id": 152134,
        "title": "",
        "nubmer": 1
      }
    },
    "created_at": "2024-04-19T17:50:18.199+08:00",
    "updated_at": "2024-04-19T17:50:18.199+08:00"
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credential)
403 Forbidden
404 Request path does not exist
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