Get all comments of a specific enterprise Issue¶
GET /api/v5/enterprises/{enterprise}/issues/{number}/comments
This endpoint retrieves all comments of an issue under the specified enterprise and supports paginated queries. The results include the content, creation and update times of each comment, information about the issue the comment is associated with, and information about the user who posted the 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 |
|---|---|---|---|---|
enterprise |
path | string | Yes | Address path of the namespace that owns the repository (the address path of an organization or individual) |
number |
path | integer | Yes | Globally unique issue ID |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page: maximum 100, defaults to 20 |
Response parameters¶
The response body is an array of comment objects. Each array element contains the comment content, the issue associated with the comment, and information about the user who posted the comment.
comment object (array element)
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
comment.body |
string | Yes | — | Comment content |
comment.created_at |
string | Yes | — | Comment creation time |
comment.id |
integer | Yes | — | Comment ID |
comment.target |
object | Yes | — | Comment target object |
comment.updated_at |
string | Yes | — | Comment update time |
comment.user |
object | Yes | — | Information about the user who posted the comment |
comment.target object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
comment.target.issue |
object | Yes | — | Information about the issue associated with the comment |
comment.target.issue object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
comment.target.issue.id |
integer | Yes | — | Globally unique issue ID |
comment.target.issue.iid |
integer | Yes | — | Number of the issue within its namespace |
comment.target.issue.title |
string | Yes | — | Issue title |
comment.user object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
comment.user.id |
integer | Yes | — | User ID |
comment.user.login |
string | Yes | — | User login name |
comment.user.name |
string | Yes | — | User nickname |
comment.user.type |
string | Yes | — | User type, such as User |
Error responses¶
This endpoint returns an error response when parameters are invalid or the resource does not exist. The error field names are subject to the actual backend response.
400 Invalid parameters
404 Resource not found
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Bad request (Bad Request) |
401 |
Requires authentication (Requires authentication) |
403 |
Forbidden (Forbidden) |
404 |
Resource not found (Not Found) |
Request example¶
Parameter notes¶
Replace
<enterprise>with the address path of the enterprise/organization (the address path of the namespace that owns the repository); replace<number>with the globally unique ID of the issue. This endpoint allows anonymous access; you can also pass theaccess_tokenquery parameter for authentication.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/enterprises/<enterprise>/issues/<number>/comments?page=1&per_page=20' -H 'Accept: application/json'
JavaScript¶
const response = await fetch("https://api.atomgit.com/api/v5/enterprises/<enterprise>/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/enterprises/<enterprise>/issues/<number>/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": "etst",
"created_at": "2024-12-10T16:02:21+08:00",
"id": 1535981,
"target": {
"issue": {
"id": 471521,
"iid": 1,
"title": "bbbbb"
}
},
"updated_at": "2024-12-10T16:02:21+08:00",
"user": {
"id": 287,
"login": "csdn_fenglh",
"name": "fenglh",
"type": "User"
}
}
]
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters or unparsable request |
401 |
Unauthenticated or invalid credentials |
403 |
Forbidden |
404 |
Request path does not exist or resource does not exist |
405 |
Request method not allowed |
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