Set project modules¶
PUT /api/v5/repos/{owner}/{repo}/module/setting
Sets the project modules of the specified repository. You can enable or disable the wiki, issue, security configuration, merge request, fork, analysis, and discussion modules individually; modules not included in the request body keep their current settings.
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 organization or user) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body sets the project modules to enable. Fields absent from the request body keep their current settings; each field is a boolean switch, where true enables the module and false disables it.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"has_wiki": {
"description": "Whether to set the wiki",
"type": "boolean"
},
"has_issue": {
"description": "Whether to set issues",
"type": "boolean"
},
"has_security": {
"description": "Whether to set the security configuration",
"type": "boolean"
},
"has_merge_request": {
"description": "Whether to set merge requests",
"type": "boolean"
},
"has_fork": {
"description": "Whether to set forks",
"type": "boolean"
},
"has_analysis": {
"description": "Whether to set analysis",
"type": "boolean"
},
"has_discussion": {
"description": "Whether to set discussions",
"type": "boolean"
}
}
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
msg |
string | Yes | No | Response message; success on success |
code |
integer | Yes | No | Response status code; 1 on success |
Error response¶
401 Unauthenticated
403 No permission
404 Repository does not exist
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Not found |
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>/module/setting?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"has_wiki": true,
"has_issue": true,
"has_security": true,
"has_merge_request": true,
"has_fork": true,
"has_analysis": true,
"has_discussion": true
}'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/module/setting?access_token=<token>",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({
has_wiki: true,
has_issue: true,
has_security: true,
has_merge_request: true,
has_fork: true,
has_analysis: true,
has_discussion: true,
}),
}
);
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>/module/setting",
params={"access_token": "<token>"},
headers={
"Content-Type": "application/json",
"Accept": "application/json",
},
json={
"has_wiki": True,
"has_issue": True,
"has_security": True,
"has_merge_request": True,
"has_fork": True,
"has_analysis": True,
"has_discussion": True,
},
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) |
403 |
No permission to perform repository settings operations |
404 |
Repository 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