Files
Method to Get File Content
GET /project/{ownerAlias}/{projectAlias}/blob?commitHash={commitHash}&file={fileName}
This request returns the contents of a file (changed in the specified commit) as a string. If the file is larger than 15MB, or if it is binary/image, you should use the method below.
Path Variable | Type | Description |
---|---|---|
ownerAlias |
String | Project owner alias |
projectAlias |
String | Project alias |
commitHash |
String | Required. Commit hash representing the repository state |
fileName |
String | Required. Full path to the file, including name and extension |
To increase the maximum file size for this method, set
gitflic.rest.maxBlobSize
(bytes) inapplication.properties
.
Responses
STATUS 200
example JSON:
Example Response
File content sample
STATUS 400
- Cannot convert binary/image file to string. Use the download method instead.
STATUS 403
- Access denied.
STATUS 404
- Not found.
Method to Download File as Byte Stream
GET /project/{ownerAlias}/{projectAlias}/blob/download?commitHash={commitHash}&file={fileName}
This request returns the file contents (changed in the specified commit) as a byte stream. If the file is larger than 15MB or is binary/image, use this method.
Path Variable | Type | Description |
---|---|---|
ownerAlias |
String | Project owner alias |
projectAlias |
String | Project alias |
commitHash |
String | Required. Commit hash representing the repository state |
fileName |
String | Required. Full path to the file, including name and extension |
Responses
STATUS 200
- File stream received.
STATUS 403
- Access denied.
STATUS 404
- Not found.
Method to Get File List Recursively
GET /project/{ownerAlias}/{projectAlias}/blob/recursive?commitHash={commitHash}&directory={directory}&depth={depth}
This request returns a list of files (not folders) and their info, starting from a specific directory and up to a certain depth.
Path Variable | Type | Description |
---|---|---|
ownerAlias |
String | Project owner alias |
projectAlias |
String | Project alias |
commitHash |
String | Required. Commit hash representing the repository state |
directory |
String | Optional. Start directory for the search (default: root of repository) |
depth |
Integer | Optional. Search depth (default: 0, max: 10; root = depth 0). |
To increase the max recursion depth, set
gitflic.rest.maxRecursionDepth
inapplication.properties
.
Responses
File JSON structure:
Field | Type | Description |
---|---|---|
filePath |
String | Path to the file |
extension |
String | File extension |
size |
Integer | File size in bytes |
lfsOid |
String | OID for LFS files |
lockedBy |
String | Username who locked the file, or null if not locked |
STATUS 200
example JSON:
Example Response
[
{
"filePath": ".gitignore",
"extension": ".gitignore",
"size": 290,
"lfsOid": null,
"lockedBy": null
},
{
"filePath": "CODEOWNERS",
"extension": ".null",
"size": 32,
"lfsOid": null,
"lockedBy": null
},
{
"filePath": "README.md",
"extension": ".md",
"size": 7507,
"lfsOid": null,
"lockedBy": null
},
{
"filePath": "app.blade.php",
"extension": ".php",
"size": 43871537,
"lfsOid": "88fbda4b912596b9f56e8e12e580cc954bacfb51776ecfddd3e18fc1cf56dc4c",
"lockedBy": "adminuser"
},
{
"filePath": "gitflic-ci.yaml",
"extension": ".yaml",
"size": 594,
"lfsOid": null,
"lockedBy": null
}
]
STATUS 403
- Access denied.
STATUS 404
- Not found.
Method to Get File Size
GET /project/{projectUuid}/file-size?filepath={filepath}&branchName={branchName}
Returns the file size in bytes.
Path Variable | Type | Description |
---|---|---|
projectUuid |
String | Unique project ID |
filepath |
String | File path |
branchName |
String | Name of the branch containing the file |
Responses
STATUS 200
example JSON:
Example Response
"11843566 bytes"
STATUS 403
- Access denied.
STATUS 404
- Not found.
Automated translation!
This page was translated using automatic translation tools. The text may contain inaccuracies.