Get file list¶
GET /api/v5/repos/{owner}/{repo}/file_list
This endpoint retrieves the file list of the specified repository. You can locate the file version by branch, tag, or commit, and search by file name. The response returns the list of paths of all files in the repository.
Access token support¶
- AtomGit user access tokens (AtomGit user access tokens)
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace address the repository belongs to (organization or personal path) |
repo |
path | string | Yes | Repository path (path) |
ref_name |
query | string | No | ref (branch, tag, commit) |
file_name |
query | string | No | File name to search for |
Response parameters¶
The response body is an array of strings. Each array element is a file path, representing the file list in the repository.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
| (array element) | string | Yes | No | File path, such as abc/test.rs |
Error responses¶
In addition to the success response, this endpoint may return the following error responses when a private repository is accessed or when the resource does not exist.
401 Unauthenticated
404 Resource not found
The error field names are subject to the actual backend response.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Forbidden |
404 |
Resource not found (Not Found) |
Request example¶
Parameter notes¶
This endpoint allows anonymous access, so the examples can omit the access token. To access a private repository, you can include an AtomGit user access token.
Replace
<owner>with the namespace address the repository belongs to (organization or personal path); Replace<repo>with the repository path (path); Replace<ref>with a branch, tag, or commit (optional); Replace<file_name>with the file name to search for (optional).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/file_list?ref_name=<ref>&file_name=<file_name>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/file_list?ref_name=<ref>&file_name=<file_name>",
{
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>/file_list",
params={"ref_name": "<ref>", "file_name": "<file_name>"},
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/invalid access credentials) |
400 |
Invalid parameters or the request cannot be parsed |
403 |
Forbidden |
404 |
The requested path or resource 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