π Dropbox File Upload API II
Upload and share files easily - Part II
Project Overview
Upload and share files easily - Part II
Dropbox File Upload API II is the direct successor to Dropbox File Upload API I, extending the original upload/download/delete functionality with:
- Version Control: multiple versions per file with immutable history
- Expiration Policies: set, update, or clear per-version TTLs for automatic cleanup
- Revert Capability: roll back to any prior version as a new version entry
- Selective Deletion: remove individual versions or entire file records
Your submissions
No submissions yet, start by making your first submission
Detailed Project Description
The Dropbox File Upload API II builds on basic file-upload functionality by introducing version control, expiration policies, and advanced lifecycle management. Users can:
- Upload new files and additional versions
- List files (with only the latest non-expired version)
- Inspect full version histories
- Download the latest or any specific version
- Revert to prior versions
- Set or remove automatic expiration dates
- Delete individual versions or entire file records
This project deepens your understanding of RESTful API design, file storage, multipart handling, in-memory state management, and robust error handling.
New Features
- Versioning: Track multiple versions of each file, with immutable history.
- Expiration: Assign per-version TTLs so old data auto-expires.
- Revert: Roll back to any prior version, which spawns a new version entry.
- Selective Deletion: Remove single versions or wipe entire file records.
- Enhanced Edge-Case Handling: Large uploads (>100 MB), unsupported types, malformed IDs, expired resources.
Detailed Requirements
Implement a RESTful API supporting:
-
Upload / Versioning:
POST /api/files/upload
-
List Files:
GET /api/files
-
List Versions:
GET /api/files/:fileId/versions
-
Download Latest:
GET /api/files/:fileId
-
Download Specific Version:
GET /api/files/:fileId/versions/:versionId
-
Revert Version:
POST /api/files/:fileId/versions/:versionId/revert
-
Set / Remove Expiration:
PATCH /api/files/:fileId/expiration
-
Delete Version:
DELETE /api/files/:fileId/versions/:versionId
-
Delete File:
DELETE /api/files/:fileId
-
Error Cases:
- Missing or invalid file uploads
- Invalid or non-existent IDs
- Unsupported MIME types (e.g.
.exe
) - File size limits (
100 MB
) - Expired versions not accessible
API Endpoints
POST /api/files/upload
Upload a new file or a new version.
-
Form-Data:
file
(required)
-
JSON Body (optional):
fileId
(string) β existing file to versionexpiresAt
(ISO 8601) β future timestamp ornull
-
Success (201)
{ "fileId": "string", "versionId": "string", "versionNumber": 1, "filename": "string", "size": 12345, "mimeType": "text/plain", "createdAt": "2025-04-06T12:00:00Z", "expiresAt": "2025-05-01T12:00:00Z" // or null }
-
Errors
400
Missing file / invalidexpiresAt
404
fileId
not found415
Unsupported media type (.exe
)413
File too large (>100 MB)
GET /api/files
List all filesβ latest non-expired versions.
-
Success (200)
[ { "fileId": "string", "filename": "string", "latestVersion": { "versionId": "string", "versionNumber": 2, "size": 23456, "mimeType": "image/png", "createdAt": "2025-04-06T13:00:00Z", "expiresAt": null } } ]
GET /api/files/:fileId
Download the latest version if it hasnβt expired.
- Success (200): Raw file stream (
Content-Type: application/octet-stream
) - Errors:
404
Not found or expired
GET /api/files/:fileId/versions
List all non-expired versions of a file.
-
Success (200)
[ { "versionId": "string", "versionNumber": 1, "size": 12345, "mimeType": "text/plain", "createdAt": "2025-04-06T12:00:00Z", "expiresAt": null } ]
-
Errors:
404
File not found
GET /api/files/:fileId/versions/:versionId
Download a specific version if it hasnβt expired.
- Success (200): Raw file stream
- Errors:
404
File or version not found / expired
POST /api/files/:fileId/versions/:versionId/revert
Revert to a previous version (creates new version entry).
-
Success (200)
{ "fileId": "string", "versionId": "string", "versionNumber": 3, "createdAt": "2025-04-06T14:00:00Z" }
-
Errors:
404
File or version not found / expired
PATCH /api/files/:fileId/expiration
Set or remove expiration for the latest version.
-
Body
{ "expiresAt": "2025-06-01T12:00:00Z" } // or null
-
Success (200)
{ "fileId": "string", "latestVersion": { "versionId": "string", "versionNumber": number, "expiresAt": "2025-06-01T12:00:00Z" // or null } }
-
Errors:
400
Invalid format or past date404
File not found
DELETE /api/files/:fileId/versions/:versionId
Delete a single version.
-
Success (200)
{ "message": "Version deleted successfully" }
-
Errors:
404
File or version not found
DELETE /api/files/:fileId
Delete all versions and remove the file record.
-
Success (200)
{ "message": "File and all versions deleted successfully" }
-
Errors:
404
File not found
Project Completion Criteria
- Upload new files and versions
- List files and version histories
- Download latest & specific versions
- Revert to earlier versions
- Set and remove expirations
- Delete individual versions and full files
- Proper error handling (unsupported types, size limits, invalid/past TTL, expired resources)