Get the patch of a commit¶
GET /api/v5/repos/{owner}/{repo}/commit/{sha}/patch
This endpoint returns the patch of a specific commit in the specified repository. It returns the file changes introduced by the commit in unified diff format, making it easy to review the exact changes.
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 path of the namespace that owns the repository (address path of the enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
sha |
path | string | Yes | Commit SHA |
Response parameters¶
The response body is the patch content of the specified commit (string, plain text), describing the file changes introduced by the commit in unified diff format.
Note: The response is the patch text itself, not a JSON object.
Request example¶
Parameter description¶
Replace
<owner>with the address path of the namespace that owns the repository (address path of the enterprise, organization, or user); Replace<repo>with the repository path (path); Replace<sha>with the SHA of the commit.
cURL¶
Note: This endpoint allows anonymous access. To access a private repository, append ?access_token=<token> to the URL.
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/commit/<sha>/patch", {
headers: {
"Accept": "text/plain",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.text();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/commit/<sha>/patch",
headers={"Accept": "text/plain"},
timeout=10,
)
resp.raise_for_status()
print(resp.text)
Response example¶
Status code: 200
diff --git a/README.md b/README.md
index e69de29..d00491f 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1 @@
+# Example
Error response¶
This endpoint does not explicitly define a business failure response. On error, the gateway/framework returns a generic error (such as 401 unauthenticated, 404 resource not found, or 500 internal error). The actual error body is whatever is returned.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required |
404 |
Resource not found |
500 |
Internal server error |
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
404 |
The requested resource does not exist |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc