Sync fork repository with source repository¶
PUT /api/v5/repos/{owner}/{repo}/sync_repo
Call this endpoint to sync a fork repository with its source repository.
Access token support¶
- AtomGit user access tokens
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Address of the namespace that owns the repository (the address path of the enterprise, organization, or personal namespace) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"branch": {
"description": "Name of the branch to pull updates into. If omitted, all branches are updated.",
"type": "string"
}
},
"required": []
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
repo_sync_result |
boolean | Yes | — | Synchronization result; true means the synchronization succeeded |
repo_sync_message |
string | Yes | — | Synchronization result message |
Error response¶
401 Unauthenticated
404 Repository not found
Note: The actual error field names in failure responses depend on what the backend returns.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Succeeded (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Repository not found (Not found) |
Request example¶
Parameter notes¶
Replace
<owner>with the address of the namespace that owns the repository (the address path of the enterprise, organization, or personal namespace); replace<repo>with the repository path (path); replace<token>with your AtomGit user access token; replace<branch>with the name of the branch to pull updates into (optional).
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/sync_repo?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"branch":"<branch>"}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/sync_repo?access_token=<token>",
{
method: "PUT",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ branch: "<branch>" }),
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.put(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/sync_repo",
params={"access_token": "<token>"},
json={"branch": "<branch>"},
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 or invalid access credentials) |
404 |
The request path or the repository does not exist |
405 |
The request method is 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