Update organization discussion¶
PUT /api/v5/orgs/{org}/discuss/{number}
This endpoint updates the content of a discussion in the specified organization. You can change the discussion title, body content (in Markdown format), and category, and it returns the updated discussion details.
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) |
number |
path | integer | Yes | Discussion number |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is required. The meaning of each field is as follows:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"title": {
"description": "Discussion title",
"type": "string"
},
"md_content": {
"description": "Discussion content (markdown)",
"type": "string"
},
"category_name": {
"description": "Name of the category the discussion belongs to",
"type": "string"
}
},
"required": []
}
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 content (markdown) |
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 in the category |
is_closed |
integer | Yes | No | Whether closed |
is_answered |
integer | Yes | No | Whether answered |
comment_total |
integer | Yes | No | Comment total |
category |
object | Yes | No | Category the discussion belongs to |
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 | User 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 returns the corresponding error on authentication failure or a parameter error. 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 (Bad Request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Resource not found (Not Found) |
500 |
Internal server error |
Request example¶
Parameter description¶
Replace
<org>with the organization path (path); replace<number>with the discussion number; replace<token>with your AtomGit user access token.
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>?access_token=<token>' \
-H 'Content-Type: application/json' \
-d '{"title":"New discussion title","md_content":"Updated 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/<number>?access_token=<token>", {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "New discussion title",
md_content: "Updated 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.put(
"https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>",
params={"access_token": "<token>"},
json={
"title": "New discussion title",
"md_content": "Updated discussion content",
"category_name": "Category name",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": "string",
"number": 0,
"title": "string",
"md_content": "string",
"created_at": "string",
"updated_at": "string",
"author": {
"avatar_url": "string",
"id": "string",
"object_id": "string",
"login": "string",
"name": "string"
},
"is_lock": 0,
"is_pin": 0,
"is_category_pin": 0,
"is_closed": 0,
"is_answered": 0,
"comment_total": 0,
"category": {
"id": "string",
"name": "string",
"icon": "string",
"description": "string",
"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