Skip to content

Reply to repository discussion comment

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

This endpoint replies to a specific comment in a discussion in the specified repository. You submit the comment content in Markdown format to complete the reply, and it returns details of the created reply.

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 number
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object containing the comment content to reply with:

{
  "$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 reply ID
created_at string Yes No Creation time
updated_at string Yes No Update time
author object Yes No Author information
discuss_id string Yes No Discussion number
content string Yes No Comment content
md_content string Yes No Comment content (markdown)
parent_id string Yes No Parent comment number
type integer Yes No Comment type, 1: comment, 2: reply
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 logged-in user has liked
is_deleted integer Yes No Whether deleted
is_remark integer Yes No Whether marked

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 User name

Error response

The endpoint returns the following error responses when parameter validation fails or authentication fails (error field names follow 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)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Resource not found (Not found)

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 number; replace <token> with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>/comment/<id>/reply?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"md_content": "Reply comment content"}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>/comment/<id>/reply?access_token=<token>", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({ md_content: "Reply 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.post(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss/<number>/comment/<id>/reply",
    params={"access_token": "<token>"},
    json={"md_content": "Reply comment content"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": "Reply comment ID",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "author": {
    "avatar_url": "https://api.atomgit.com/avatar.png",
    "id": "User ID",
    "object_id": "Object ID",
    "login": "octocat",
    "name": "octocat"
  },
  "discuss_id": "Discussion ID",
  "content": "Reply content",
  "md_content": "Reply content",
  "parent_id": "Parent comment ID",
  "type": 2,
  "is_hide": 0,
  "reply_total": 0,
  "like_total": 0,
  "is_like": false,
  "is_deleted": 0,
  "is_remark": 0
}

Error codes

Error code Description
200 Success
400 Parameter error or unparsable request
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
403 Access forbidden, no permission
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