Create organization discussion¶
POST /api/v5/orgs/{org}/discuss
This endpoint creates a new discussion under the specified organization. The request must provide the discussion title, discussion content (in Markdown format), and category name. On success, it returns the complete discussion information.
Access token support¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint does not allow anonymous access
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
org |
path | string | Yes | Organization path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is in JSON format, and the required fields are title, md_content, and category_name.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"title": {
"description": "Discussion title",
"type": "string"
},
"md_content": {
"description": "Discussion content (Markdown format)",
"type": "string"
},
"category_name": {
"description": "Name of the category the discussion belongs to",
"type": "string"
}
},
"required": ["title", "md_content", "category_name"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
string | Yes | No | Discussion ID |
number |
integer | Yes | No | Discussion number |
title |
string | Yes | No | Title |
md_content |
string | Yes | No | Discussion content (Markdown format) |
created_at |
string | Yes | No | Creation time |
updated_at |
string | Yes | No | Update time |
author |
object | Yes | No | Author information |
is_lock |
integer | Yes | No | Whether locked |
is_pin |
integer | Yes | No | Whether pinned |
is_category_pin |
integer | Yes | No | Whether pinned in the category |
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 | Category information |
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 | Username |
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 |
Error response¶
This endpoint requires authentication; it returns 401 when no valid access token is carried or the token is invalid, and 400 when request body parameters are missing or malformed. The error response field names are subject to what the backend actually returns.
401 Unauthenticated
400 Parameter error
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Parameter error or unparsable request |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Request path does not exist |
405 |
Method not supported |
429 |
Too many requests; rate limit triggered |
500 |
Internal server error |
Request example¶
Parameter description¶
Replace
<org>with the organization path (path); replace<token>with your AtomGit user access token.
cURL¶
curl -X POST 'https://api.atomgit.com/api/v5/orgs/<org>/discuss?access_token=<token>' -H 'Content-Type: application/json' -d '{"title":"Discussion title","md_content":"Discussion content","category_name":"Category name"}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/orgs/<org>/discuss?access_token=<token>", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "Discussion title",
md_content: "Discussion content",
category_name: "Category name",
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.post(
"https://api.atomgit.com/api/v5/orgs/<org>/discuss",
params={"access_token": "<token>"},
json={"title": "Discussion title", "md_content": "Discussion content", "category_name": "Category name"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": "o_xxxx",
"number": 3,
"title": "How do I get started quickly",
"md_content": "This is a piece of discussion content",
"created_at": "2026-10-14T00:00:00Z",
"updated_at": "2026-10-14T00:00:00Z",
"author": {
"avatar_url": "https://api.atomgit.com/avatar.png",
"id": "u_xxxx",
"object_id": "obj_xxxx",
"login": "octocat",
"name": "octocat"
},
"is_lock": 0,
"is_pin": 0,
"is_category_pin": 0,
"is_closed": 0,
"is_answered": 0,
"comment_total": 0,
"category": {
"id": "c_xxxx",
"name": "Default category",
"icon": "https://api.atomgit.com/icon.png",
"description": "Default discussion category",
"type": 0
}
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
400 |
Parameter error or unparsable request |
404 |
Request path does not exist |
405 |
Method not supported |
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