Skip to content

Reply to a pull request comment

POST /api/v5/repos/{owner}/{repo}/pulls/{number}/discussions/{discussion_id}/comments

This endpoint replies to a comment in a specified pull request discussion. After you submit the reply body, the reply is written to the corresponding discussion as a new comment, and the comment ID and body content are returned.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address of the namespace the repository belongs to (the address path of the organization or individual)
repo path string Yes Repository path (path)
number path integer Yes The PR number, i.e. the sequence number of the PR in this repository
discussion_id path string Yes Discussion id

Request Body:

The request body is the content of the reply comment and carries the body field.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "body": {
      "description": "Body content of the reply comment",
      "type": "string"
    }
  },
  "required": ["body"]
}

Response parameters

Field Type Always returned Nullable Description
id string Yes No Discussion id
noteId integer Yes No Comment id
body string Yes No Body content of the reply comment

Error responses

This endpoint may return the following failure status codes. The specific field names in the error response body are subject to what the backend actually returns.

400 Parameter error

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

HTTP response status codes

Status code Description
200 Success (OK)
400 Parameter error (Bad Request)
401 Authentication required (Unauthorized)
403 Forbidden
404 Request path does not exist (Not Found)
429 Too many requests; rate limit triggered (Too Many Requests)
500 Internal system error (Internal Server Error)

Request example

Parameter description

The example must be consistent with the rest of this document; copy it as-is to make a successful call.

  • This endpoint allows anonymous access, so the example does not carry an access token. If you need authentication, you can pass an AtomGit user access token.
  • Replace <owner> with the address of the namespace the repository belongs to (the address path of the organization or individual); replace <repo> with the repository path (path); replace <number> with the PR number (the Nth PR); replace <discussion_id> with the discussion id.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/discussions/<discussion_id>/comments' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"body": "Thanks for the feedback; the issue has been fixed"}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/discussions/<discussion_id>/comments",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({
      body: "Thanks for the feedback; the issue has been fixed",
    }),
  }
);

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>/pulls/<number>/discussions/<discussion_id>/comments",
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={"body": "Thanks for the feedback; the issue has been fixed"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": "5f8f8f8f-8b8c-4f2e-9a1a-0c1d2e3f4a5b",
  "noteId": 1024,
  "body": "Thanks for the feedback; the issue has been fixed"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
400 Parameter error, or the request cannot be parsed
404 Request path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc