Skip to content

Get the modification history of a pull request

GET /api/v5/repos/{owner}/{repo}/pulls/{number}/modify_history

Retrieves the modification history of the given pull request in the specified repository, returning a list of modification records with the modification time, modified content, and the user information of the operator and updater.

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace address to which the repository belongs (address path of the enterprise, organization, or user)
repo path string Yes Repository path (path)
number path string Yes Pull request number (case-sensitive; no # prefix needed)

Response parameters

The response body is an array of modification history records; each element has the structure below:

Field Type Always returned Nullable Description
id string Yes — Modification history record ID
created_at string Yes — Creation time
updated_at string Yes — Modification time
deleted boolean Yes — Whether it has been deleted
created boolean Yes — Whether this is a creation record
content string Yes — Content after modification
user object Yes — Information about the operating user
updated_user object Yes — Information about the updating user

user object

Field Type Always returned Nullable Description
user.login string Yes — Login name
user.name string Yes — Name
user.avatar_url string Yes — Avatar URL
user.object_id string Yes — Object ID

updated_user object

Field Type Always returned Nullable Description
updated_user.login string Yes — Login name
updated_user.name string Yes — Name
updated_user.avatar_url string Yes — Avatar URL
updated_user.object_id string Yes — Object ID

Error response

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "The parameter number is invalid"
}

404 Resource does not exist

{
  "error": "not_found",
  "message": "Pull request or repository does not exist"
}

Error field names follow what the backend actually returns.

HTTP status codes

Status code Description
200 Success (OK)
304 Not modified
400 Parameter error (Bad request)
401 Authentication required (Requires authentication)
404 Resource does not exist (Not found)
500 Internal server error (Internal server error)

Request example

Parameter notes

replace <owner> with the namespace address to which the repository belongs (address path of the enterprise, organization, or user); replace <repo> with the repository path (path); replace <number> with the pull request number.

Note: This endpoint allows anonymous access, so the request example sends no access token; if you need to send one, use an AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/modify_history' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/modify_history",
  {
    headers: {
      "Accept": "application/json",
    },
  }
);

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

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

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/modify_history",
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": "123456",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-02T00:00:00Z",
    "deleted": false,
    "created": true,
    "content": "Modified file content",
    "user": {
      "login": "octocat",
      "name": "octocat",
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "object_id": "user_1"
    },
    "updated_user": {
      "login": "octocat",
      "name": "octocat",
      "avatar_url": "https://api.atomgit.com/avatar.png",
      "object_id": "user_1"
    }
  }
]

Error codes

Error code Description
400 Invalid parameters or unparseable request
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
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