A Spring Boot REST API that uploads video files from a local machine directly to Google Drive using the Google Drive API and OAuth 2.0 Authentication.
- Upload videos to Google Drive
- OAuth 2.0 Authentication
- Multipart file upload
- Returns Google Drive file link
- REST API with Spring Boot
- Tested using Postman
- Java 21
- Spring Boot 3
- Maven
- Google Drive API
- Google OAuth 2.0
- Postman
src ├── controller ├── dto ├── exception ├── service ├── serviceImpl └── resources
POST
/api/drive/upload
Request
- Content-Type:
multipart/form-data - Parameter:
file
json { "success": true, "message": "Video Uploaded Successfully", "fileName": "sample.mp4", "driveLink": "https://drive.google.com/file/d/xxxxx/view" }
Place your credentials.json inside:
src/main/resources/
Configure:
properties server.port=8080 google.drive.folder-id=YOUR_FOLDER_ID
git clone https://github.com/your-username/GoogleDriveUpload.git
cd GoogleDriveUpload
mvn spring-boot:run
## 🧪 Test Using Postman
POST http://localhost:8080/api/drive/upload
Choose **Body → form-data**, add a key named **file** (type **File**), select a video, and click **Send**.
## 📚 Concepts Covered
- Spring Boot REST API
- Google Drive API Integration
- OAuth 2.0 Authentication
- Multipart File Upload
- Exception Handling
- DTO & Service Layer