Update the permission mode of a repository¶
PUT /api/v5/repos/{owner}/{repo}/transition
Updates the member permission management mode of the specified repository (inherited mode / independent mode). Only users with repository management permission can call it.
Supported access tokens¶
- 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 | Namespace address to which the repository belongs (address path of the enterprise, organization, or user) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
mode is required and specifies the new member permission management mode. Submit the body as JSON with Content-Type: application/json.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"mode": {
"description": "Member permission management mode: 1 (inherited mode), 2 (independent mode); the mixed mode cannot be set",
"type": "integer",
"enum": [1, 2]
}
},
"required": ["mode"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
msg |
string | Yes | No | Operation result message; success on success |
code |
integer | Yes | No | Result code; 1 on success |
Error response¶
When the request fails, the endpoint returns an error response body with snake_case fields; the field names follow what the backend actually returns:
{
"error_code": 400,
"error_code_name": "BAD_REQUEST",
"error_message": "Invalid parameters",
"trace_id": "xxxx"
}
403 Access forbidden
{
"error_code": 403,
"error_code_name": "FORBIDDEN",
"error_message": "The system is currently upgrading the member permission model, so this endpoint is temporarily unavailable."
}
401 Unauthenticated
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Invalid parameters (Bad Request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Resource does not exist (Not Found) |
429 |
Too many requests (Too Many Requests) |
500 |
Internal system 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<token>with your AtomGit user access token.
cURL¶
curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/transition?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"mode": 1}'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/transition?access_token=<token>",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({ mode: 1 }),
}
);
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>/transition",
params={"access_token": "<token>"},
headers={"Content-Type": "application/json", "Accept": "application/json"},
json={"mode": 1},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters or the request cannot be parsed |
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
403 |
Access forbidden (for example, while the system is upgrading the member permission model) |
404 |
Request path or resource does not exist |
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