Skip to content

Edit a comment

PATCH /api/v5/repos/{owner}/{repo}/pulls/comments/{id}

This endpoint edits the content of a comment under a specified pull request in a repository. It locates the target comment by comment ID and submits the new comment content. On success, it returns an empty object; on failure, it returns the corresponding error information.

Access token support

  • AtomGit user access tokens

Anonymous access allowed

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes The namespace address the repository belongs to (the address path of an organization or individual)
repo path string Yes Repository path (path)
id path integer Yes Comment ID
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object with the following field:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "body": {
      "description": "Comment content (required)",
      "type": "string"
    }
  },
  "required": ["body"]
}

Response parameters

A successful response returns an empty object {} with no response fields.

Error responses

400 Invalid parameters

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

401 Unauthenticated

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

The error field names above are subject to what the backend actually returns.

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Requires authentication
403 Forbidden
404 Request path not found

Request example

Parameter description

Description of the placeholders in the example:

Replace <owner> with the namespace address the repository belongs to (the address path of an organization or individual); replace <repo> with the repository path (path); replace <id> with the comment ID; replace <token> with your AtomGit user access token; replace <body> with the comment content.

cURL

curl -X PATCH "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/comments/<id>?access_token=<token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d "{\"body\": \"<body>\"}"

JavaScript

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

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.patch(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/comments/<id>",
    params={"access_token": "<token>"},
    json={"body": "<body>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Invalid parameters or unparseable request
404 Request path not found
405 Request 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