Skip to content

Update repository discussion comment

PUT /api/v5/repos/{owner}/{repo}/discuss/{number}/comment/{id}

This endpoint updates the content of a comment under a discussion in the specified repository. It accepts new comment content in Markdown format and returns the updated comment details, including the comment content, author information, associated discussion, likes, replies, and other data.

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
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
id path string Yes Comment ID
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object containing the comment content to update.

{
  "$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 — Comment ID
created_at string Yes — Creation time
updated_at string Yes — Update time
author object Yes — Comment author information
discuss_id string Yes — Owning discussion ID
content string Yes — Comment content
md_content string Yes — Comment content (markdown)
parent_id string Yes — Parent comment ID
type integer Yes — Comment type, 1: comment, 2: reply
is_hide integer Yes — Whether hidden
reply_total integer Yes — Reply total
like_total integer Yes — Like total
is_like boolean Yes — Whether the current user has liked
is_deleted integer Yes — Whether deleted
is_remark integer Yes — Whether flagged/marked

author object

Field Type Always returned Nullable Description
author.avatar_url string Yes — Author avatar URL
author.id string Yes — Author ID
author.object_id string Yes — Author object ID
author.login string Yes — Author login name
author.name string Yes — Author name

Error response

When the call fails, the endpoint returns the corresponding error status code and error message. The following are common failure examples (the error field names are subject to what the backend actually returns).

400 Parameter error

{
  "error": "invalid_request",
  "message": "Parameter md_content cannot be empty",
  "field": "md_content"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

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)
429 Too many requests (Rate limited)
500 Internal server error

Request example

Parameter description

Replace <owner> with the namespace path of the repository (the path of an enterprise, organization, or personal address); replace <repo> with the repository path (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/repos/<owner>/<repo>/discuss/<number>/comment/<id>?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"md_content": "Updated comment content (markdown)"}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>/comment/<id>?access_token=<token>",
  {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({
      md_content: "Updated comment content (markdown)",
    }),
  }
);

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/repos/<owner>/<repo>/discuss/<number>/comment/<id>",
    params={"access_token": "<token>"},
    json={"md_content": "Updated comment content (markdown)"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": "c_1001",
  "created_at": "2026-10-14T10:00:00Z",
  "updated_at": "2026-10-14T10:30:00Z",
  "author": {
    "avatar_url": "https://api.atomgit.com/avatar.png",
    "id": "u_2001",
    "object_id": "obj_3001",
    "login": "octocat",
    "name": "octocat"
  },
  "discuss_id": "d_5001",
  "content": "Updated comment content",
  "md_content": "Updated comment content (markdown)",
  "parent_id": "c_1000",
  "type": 1,
  "is_hide": 0,
  "reply_total": 0,
  "like_total": 1,
  "is_like": true,
  "is_deleted": 0,
  "is_remark": 0
}

Error codes

Error code Description
400 Parameter error or unparsable request
401 Unauthenticated or invalid credentials (missing/invalid access token)
403 You do not have permission to access this resource
404 The requested resource 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