File Management
File Management
The file management API provides endpoints for uploading, downloading, and managing files in your Infomaxim application.
GET/files/status
Retrieves the status and statistics of the file storage system.
Request Headers
Authorization: Bearer <access_token>
Success Response (200 OK)
{
"status": "Success",
"data": {
"totalFiles": 1523,
"totalSize": "2.5 GB",
"storageQuota": "10 GB",
"remainingSpace": "7.5 GB"
}
}
POST/files/upload
Uploads a file to the Infomaxim storage system.
Request Headers
Authorization: Bearer <access_token>
Content-Type: multipart/form-data
x-file-id: unique_file_identifier
name: filename.pdf
size: 2048576
app-id: 1
Parameters
-
x-file-id
string (header)
required
Unique identifier for the file upload session.
-
name
string (header)
required
Original filename with extension.
-
size
number (header)
required
File size in bytes.
-
app-id
number (header)
required
Application ID for the upload.
-
file
file (form-data)
required
The file to upload.
Success Response (201 Created)
{
"status": "Success",
"data": {
"fileId": "abc123def456",
"filename": "document.pdf",
"size": 2048576,
"url": "https://yourdomain.com/files/abc123def456"
}
}
Example Usage
// JavaScript Example with FormData
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('http://localhost:3001/files/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken,
'x-file-id': 'unique_id_123',
'name': 'document.pdf',
'size': fileInput.files[0].size.toString(),
'app-id': '1'
},
body: formData
});
const data = await response.json();
# cURL Example
curl -X POST http://localhost:3001/files/upload \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "x-file-id: unique_id_123" \
-H "name: document.pdf" \
-H "size: 2048576" \
-H "app-id: 1" \
-F "file=@/path/to/document.pdf"
GET/files/download/:fileName
Downloads a file from the Infomaxim storage system.
URL Parameters
-
fileName
string
required
The unique file identifier or filename.
Request Headers
Authorization: Bearer <access_token>
Success Response
Returns the file as binary data with appropriate Content-Type headers.