Overview
All upload endpoints:- Require authentication via JWT token
- Accept
multipart/form-datacontent type - Upload files to dedicated Google Drive folders
- Return public URLs for uploaded files
- Generate unique filenames to prevent conflicts
All upload endpoints are under the
/api/me/upload base path and require valid JWT authentication.Google Drive Integration
Portfolio Hub uses Google Drive as the file storage backend with OAuth 2.0 authentication. Files are organized into separate folders:- User Avatars: Profile pictures
- User Resumes: PDF/DOC resume files
- Project Covers: Project cover images
- Skill Icons: Skill/technology icons
- Certificates: Certificate documents and images
File Size Limits
Spring Boot’s default multipart file upload limits apply:- Max file size: 1MB (default)
- Max request size: 10MB (default)
These limits can be configured in the application properties using
spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size.Accepted File Formats
Avatar Uploads
- Recommended: JPG, PNG, WebP
- Best size: 400x400px or higher (square aspect ratio)
Resume Uploads
- Recommended: PDF, DOC, DOCX
- Note: PDF is preferred for consistent rendering
Project Cover Images
- Recommended: JPG, PNG, WebP
- Best size: 1200x630px (16:9 aspect ratio)
Skill Icons
- Recommended: PNG, SVG, WebP
- Best size: 64x64px or 128x128px (square)
Certificate Files
- Recommended: PDF, JPG, PNG
- Note: PDF for documents, images for scanned certificates
Upload Avatar
Request
The avatar image file to upload. Should be an image file (JPG, PNG, WebP).
Request Example
Response
Indicates if the upload was successful
Success message (e.g., “Avatar actualizado exitosamente”)
The updated profile data
Profile ID
Profile slug/username
User’s full name
Profile headline
Profile bio/description
Contact email address
User’s location
The newly uploaded avatar URL (Google Drive public URL)
Resume file URL (if previously uploaded)
ISO 8601 timestamp of the response
Response Example
Error Response
Upload Resume
Request
The resume file to upload. Recommended formats: PDF, DOC, DOCX.
Request Example
Response
Returns the same structure as the avatar upload endpoint, withresumeUrl field updated to the newly uploaded file’s public URL.
Upload Project Cover
Path Parameters
The ID of the project to upload the cover image for
Request
The cover image file to upload. Recommended formats: JPG, PNG, WebP.
Request Example
Response
Indicates if the upload was successful
Success message (e.g., “Portada de proyecto actualizada”)
The updated project data
Project ID
Project title
Project slug/identifier
Brief project summary
Detailed project description
Repository URL (e.g., GitHub)
Live demo URL
The newly uploaded cover image URL (Google Drive public URL)
Project start date (ISO 8601)
Project end date (ISO 8601, null if ongoing)
Whether the project is featured
Display order
Array of skills/technologies used in the project
ISO 8601 timestamp of the response
Response Example
Upload Skill Icon
Path Parameters
The ID of the skill to upload the icon for
Request
The icon file to upload. Recommended formats: PNG, SVG, WebP.
Request Example
Response
Indicates if the upload was successful
Success message (e.g., “Icono de skill actualizado”)
ISO 8601 timestamp of the response
Response Example
Upload Certificate File
Path Parameters
The ID of the certificate to upload the file for
Request
The certificate file to upload. Recommended formats: PDF, JPG, PNG.
Request Example
Response
Indicates if the upload was successful
Success message (e.g., “Archivo de certificado subido”)
The updated certificate data
Certificate ID
Associated education/course ID
Certificate name/title
Certificate description
The newly uploaded certificate file URL (Google Drive public URL)
Google Drive file ID for the uploaded certificate
ISO 8601 timestamp of the response
Response Example
Error Handling
All upload endpoints may return the following error responses:401 Unauthorized
404 Not Found
Returned when trying to upload to a non-existent resource (e.g., invalid projectId, skillId, or certificateId).500 Internal Server Error
Returned when file upload to Google Drive fails or other server errors occur.All error responses include descriptive error messages in the
message field to help diagnose issues.File Naming Convention
Uploaded files are automatically renamed using the following pattern:- Avatar:
john-doe_avatar_1709985000000.jpg - Resume:
john-doe_resume_1709985000000.pdf - Project cover:
ecommerce-platform_cover_1709985000000.png - Skill icon:
react_icon_1709985000000.svg - Certificate:
aws-certified_certificate_1709985000000.pdf
- Uniqueness: Timestamp prevents naming conflicts
- Traceability: Entity identifier shows what the file belongs to
- Organization: Type indicates the file’s purpose
Security Considerations
Authentication Required: All upload endpoints require a valid JWT token in the Authorization header.
- File Validation: While basic validation occurs, always validate file types on the client side
- Size Limits: Respect the configured file size limits to prevent timeouts
- Public Access: All uploaded files are publicly accessible via Google Drive URLs
- Ownership: Users can only upload files to their own resources (enforced by authentication)
- Path Parameters: The API validates that resources (projects, skills, certificates) belong to the authenticated user
Best Practices
- Image Optimization: Compress images before uploading to reduce file size and improve load times
- File Format Selection: Use appropriate formats (PNG for transparency, JPG for photos, PDF for documents)
- Error Handling: Implement proper error handling for upload failures and retry logic
- Progress Tracking: For large files, implement upload progress indicators in your UI
- Validation: Validate file types and sizes on the client side before uploading
- Accessibility: Provide alt text and descriptions for uploaded images