Get project discussion details¶
GET /api/v5/repos/{owner}/{repo}/discuss/{number}
This endpoint gets the details of a discussion in the specified repository. It returns the discussion title, body content, author information, category, labels, comment total, and the vote and vote options associated with the discussion, among other details.
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 | Namespace path of the repository (the path of an enterprise, organization, or personal address) |
repo |
path | string | Yes | Repository path (path) |
number |
path | string | Yes | Discussion number |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
string | Yes | No | Discussion ID |
number |
integer | Yes | No | Discussion number |
title |
string | Yes | No | Discussion title |
md_content |
string | Yes | No | Discussion body (Markdown format) |
created_at |
string | Yes | No | Creation time |
updated_at |
string | Yes | No | Update time |
author |
object | Yes | No | Discussion author information |
is_lock |
integer | Yes | No | Whether locked |
is_pin |
integer | Yes | No | Whether pinned |
is_category_pin |
integer | Yes | No | Whether pinned within the type |
is_closed |
integer | Yes | No | Whether closed |
is_answered |
integer | Yes | No | Whether an answer is accepted |
comment_total |
integer | Yes | No | Comment total |
category |
object | Yes | No | Discussion category |
vote |
object | Yes | No | Vote information (returned for vote-type discussions) |
vote_options |
array | Yes | No | Vote option list (returned for vote-type discussions) |
labels |
array | Yes | No | Label list |
author object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
author.avatar_url |
string | Yes | No | Avatar URL |
author.id |
string | Yes | No | User ID |
author.object_id |
string | Yes | No | Object ID |
author.login |
string | Yes | No | Login name |
author.name |
string | Yes | No | Nickname |
category object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
category.id |
string | Yes | No | Category ID |
category.name |
string | Yes | No | Category name |
category.icon |
string | Yes | No | Category icon |
category.description |
string | Yes | No | Category description |
category.type |
integer | Yes | No | Category type |
vote object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
vote.id |
string | Yes | No | Vote ID |
vote.created_at |
string | Yes | No | Creation time |
vote.updated_at |
string | Yes | No | Update time |
vote.question |
string | Yes | No | Vote content |
vote.vote_total |
integer | Yes | No | Vote total |
vote.real_name |
boolean | Yes | No | Whether real-name |
vote.creator_view_real_name |
boolean | Yes | No | Whether the creator can view real-name votes (0 = No, 1 = Yes) |
vote.modify_vote_times |
integer | Yes | No | Number of allowed vote changes |
vote.designated_voter |
boolean | Yes | No | Whether voters are designated (0 = No, 1 = Yes) |
vote.current_user_is_designated_voter |
boolean | Yes | No | Whether the current user is a designated voter |
vote.designated_voter_size |
integer | Yes | No | Number of designated voters |
vote.no_vote_user_size |
integer | Yes | No | Number of users who have not voted |
vote_options object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
vote_options.id |
string | Yes | No | Vote option ID |
vote_options.created_at |
string | Yes | No | Creation time |
vote_options.updated_at |
string | Yes | No | Update time |
vote_options.vote_option |
string | Yes | No | Vote option |
vote_options.option_order |
integer | Yes | No | Vote option order |
vote_options.vote_total |
integer | Yes | No | Vote count for this option |
vote_options.vote_total_percent |
integer | Yes | No | Percentage of votes for this option |
vote_options.vote_id |
string | Yes | No | Owning vote ID |
vote_options.vote_users |
array | No | Yes | Vote users |
vote_options.vote_users object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
vote_options.vote_users.avatar_url |
string | No | Yes | Avatar URL |
vote_options.vote_users.id |
string | No | Yes | User ID |
vote_options.vote_users.object_id |
string | No | Yes | Object ID |
vote_options.vote_users.login |
string | No | Yes | Login name |
vote_options.vote_users.name |
string | No | Yes | Nickname |
labels object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
labels.id |
string | Yes | No | Label ID |
labels.name |
string | Yes | No | Label name |
labels.color |
string | Yes | No | Label color |
labels.created_at |
string | Yes | No | Creation time |
labels.updated_at |
string | Yes | No | Update time |
Error response¶
Below are examples of failure responses the endpoint may return; the error field names are subject to what the backend actually returns.
400 Parameter error
401 Unauthenticated
404 Discussion does not exist
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
400 |
Parameter error (Bad request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Discussion not found (Not found) |
429 |
Too many requests; rate limit triggered |
500 |
Internal server error |
Request example¶
Parameter description¶
This endpoint allows anonymous access, so you do not need to carry an access token in the request; if you need to carry a token, append ?access_token=<token> to the URL.
Replace
<owner>with the namespace path that owns the repository (the path of an enterprise, organization, or individual); replace<repo>with the repository path; replace<number>with the discussion number.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>", {
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>/discuss/<number>",
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": "g_123456",
"number": 1,
"title": "Title of the project discussion",
"md_content": "Body content of the discussion (Markdown)",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-02T00:00:00Z",
"author": {
"avatar_url": "https://api.atomgit.com/avatar.png",
"id": "u_100",
"object_id": "object_100",
"login": "octocat",
"name": "Octocat"
},
"is_lock": 0,
"is_pin": 0,
"is_category_pin": 0,
"is_closed": 0,
"is_answered": 0,
"comment_total": 3,
"category": {
"id": "c_1",
"name": "Q&A",
"icon": "https://api.atomgit.com/icon.png",
"description": "Q&A category",
"type": 1
},
"vote": {
"id": "v_1",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"question": "Do you support this proposal?",
"vote_total": 10,
"real_name": false,
"creator_view_real_name": false,
"modify_vote_times": 1,
"designated_voter": false,
"current_user_is_designated_voter": false,
"designated_voter_size": 0,
"no_vote_user_size": 0
},
"vote_options": [
{
"id": "vo_1",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"vote_option": "Support",
"option_order": 0,
"vote_total": 6,
"vote_total_percent": 60,
"vote_id": "v_1",
"vote_users": [
{
"avatar_url": "https://api.atomgit.com/avatar.png",
"id": "u_100",
"object_id": "object_100",
"login": "octocat",
"name": "Octocat"
}
]
}
],
"labels": [
{
"id": "l_1",
"name": "discussion",
"color": "#0366d6",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
]
}
Error codes¶
| Error code | Description |
|---|---|
400 |
Parameter error or unparsable request |
401 |
Unauthenticated or invalid credentials |
403 |
Access forbidden |
404 |
The requested discussion 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