Update organization discussion comment¶
PUT /api/v5/orgs/{org}/discuss/{number}/comment/{id}
This endpoint updates the content of a comment under a discussion in the specified organization. Submit the new comment content in Markdown format to complete the update, and it returns the complete information of the updated comment.
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 |
id |
path | string | Yes | Comment ID |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is a JSON object and must contain the following field:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"md_content": {
"description": "Comment content (markdown)",
"type": "string"
}
},
"required": ["md_content"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
string | Yes | No | Comment ID |
created_at |
string | Yes | No | Creation time |
updated_at |
string | Yes | No | Update time |
author |
object | Yes | No | Comment author |
discuss_id |
string | Yes | No | Owning discussion ID |
content |
string | Yes | No | Comment content |
md_content |
string | Yes | No | Comment content (markdown) |
parent_id |
string | Yes | No | Parent comment ID |
type |
integer | Yes | No | Comment type |
is_hide |
integer | Yes | No | Whether hidden |
reply_total |
integer | Yes | No | Reply total |
like_total |
integer | Yes | No | Like total |
is_like |
boolean | Yes | No | Whether the current user has liked |
is_deleted |
integer | Yes | No | Whether deleted |
is_remark |
integer | Yes | No | Whether noted |
author object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
author.avatar_url |
string | Yes | No | Author avatar URL |
author.id |
string | Yes | No | Author user ID |
author.object_id |
string | Yes | No | Author object ID |
author.login |
string | Yes | No | Author login name |
author.name |
string | Yes | No | Author name |
Error response¶
The error field names of the endpoint's failure responses are subject to what the backend actually returns. Common failure scenarios are as follows:
401 Unauthenticated
404 Not found
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Not found (Not found) |
Request example¶
Parameter description¶
Replace
<org>with the organization path (the organization's address path); replace<number>with the discussion number; replace<id>with the comment ID; replace<token>with your AtomGit user access token.
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>/comment/<id>?access_token=<token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"md_content": "Updated comment content"}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>/comment/<id>?access_token=<token>", {
method: "PUT",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
md_content: "Updated comment content",
}),
});
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>/comment/<id>",
params={"access_token": "<token>"},
headers={
"Accept": "application/json",
"Content-Type": "application/json",
},
json={"md_content": "Updated comment content"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": "string",
"created_at": "string",
"updated_at": "string",
"author": {
"avatar_url": "string",
"id": "string",
"object_id": "string",
"login": "string",
"name": "string"
},
"discuss_id": "string",
"content": "string",
"md_content": "string",
"parent_id": "string",
"type": 0,
"is_hide": 0,
"reply_total": 0,
"like_total": 0,
"is_like": true,
"is_deleted": 0,
"is_remark": 0
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
403 |
Access forbidden |
404 |
Request path does not exist or the resource was not found |
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